00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include "TClass.h"
00043 #include "TString.h"
00044 #include "StPrimaryTrack.h"
00045 #include "StPrimaryVertex.h"
00046 #include "StTrackGeometry.h"
00047 ClassImp(StPrimaryTrack)
00048
00049 static const char rcsid[] = "$Id: StPrimaryTrack.cxx,v 2.9 2012/05/07 14:42:57 fisyak Exp $";
00050 StPrimaryTrack::StPrimaryTrack(): mVertex(0) {}
00051 const StVertex* StPrimaryTrack::vertex() const{ return mVertex; }
00052 void StPrimaryTrack::setVertex(StVertex* val) {
00053 StPrimaryVertex *p = dynamic_cast<StPrimaryVertex*>(val);
00054 if (p) mVertex = p;
00055 }
00056
00057 void StPrimaryTrack::Streamer(TBuffer &R__b)
00058 {
00059
00060
00061 if (R__b.IsReading()) {
00062 UInt_t R__s, R__c;
00063 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
00064 if (R__v > 1) {
00065 Class()->ReadBuffer(R__b, this, R__v, R__s, R__c);
00066 return;
00067 }
00068
00069 StTrack::Streamer(R__b);
00070
00071
00072 R__b >> (StPrimaryVertex*&)mVertex;
00073
00074 R__b.CheckByteCount(R__s, R__c, Class());
00075
00076
00077 } else {
00078 Class()->WriteBuffer(R__b,this);
00079 }
00080 }
00081
00082 ostream& operator<<(ostream& os, const StPrimaryTrack& track) {
00083 Short_t charge = track.geometry()->charge();
00084 StThreeVectorD g3 = track.geometry()->momentum();
00085 os << Form("%4d primary %4d q/pT %8.3f eta %8.3f phi %8.3f",
00086 track.key(),track.flag(),
00087 charge/g3.perp(),g3.pseudoRapidity(),g3.phi());
00088 os << Form(" pxyz %8.3f%8.3f%8.3f",g3.x(),g3.y(),g3.z());
00089 Double_t length = track.length();
00090 if (length > 9999.) length = 9999.;
00091 os << Form(" NP %2d NF %2d L %8.3f chi2 %8.3f/%8.3f", track.numberOfPossiblePoints(),track.fitTraits().numberOfFitPoints(),
00092 length,track.fitTraits().chi2(0),track.fitTraits().chi2(1));
00093 if (track.idTruth())
00094 os << Form(" IdT: %4i Q: %4i", track.idTruth(), track.qaTruth());
00095 return os;
00096 }