//----------------------------------------------------------- // File and Version Information: // $Id: TSvXtTrack.cc,v 1.5 2002/03/06 04:50:20 murat Exp $ // // Description: XFT tracks in SVTD bank // // // Author List: // Subir Sarkar //----------------------------------------------------------- #include #include #include #include "Stntuple/data/TSvXtTrack.hh" using namespace std; ClassImp(TSvXtTrack) void TSvXtTrack::Streamer(TBuffer &R__b) { // Stream an object of class TSvXtTrack. // data members: Single word per track if (R__b.IsReading()) { Version_t R__v = R__b.ReadVersion(); if (R__v) { } R__b >> fWord; R__b >> fValid; } else { R__b.WriteVersion(TSvXtTrack::IsA()); R__b << fWord; R__b << fValid; } } // ****** Constructors TSvXtTrack::TSvXtTrack() : fWord(0), fValid(kFALSE) { } TSvXtTrack::TSvXtTrack(const Int_t word, const Bool_t valid) : fWord(word), fValid(valid) { } // ****** Destructor TSvXtTrack::~TSvXtTrack() { } // ****** Accessors Int_t TSvXtTrack::Phi() const { return fWord & 0xfff; } Int_t TSvXtTrack::Miniwedge() const { return Phi() >> 3; } Int_t TSvXtTrack::Miniphi() const { return Phi() & 0x7; } Int_t TSvXtTrack::Wedge() const { return Miniwedge()/24; } Int_t TSvXtTrack::Ptbin() const { return (fWord >> 12) & 0x7f; } Bool_t TSvXtTrack::IsIsolated() const { return ((fWord >> 19) & 0x1) ? kTRUE : kFALSE; } Bool_t TSvXtTrack::IsShort() const { return ((fWord >> 20) & 0x1) ? kTRUE : kFALSE; } Float_t TSvXtTrack::Phirad() const { return static_cast(Phi()*2*M_PI/2304.); } Float_t TSvXtTrack::Pt() const { Float_t pt; Bool_t result = TSvXtTrack::CalculatePt(IsShort(), Ptbin(), &pt); return pt; } Float_t TSvXtTrack::Curv() const { return TSvXtTrack::GetCurvature(Pt()); } // ****** Overloaded methods void TSvXtTrack::Clear(Option_t *opt) { } //_____________________________________________________________________________ void TSvXtTrack::Print(Option_t *opt) const { // Print variables in a nice format if (!strcmp(opt, "banner") || !strcmp(opt, "Banner")) { cout << " Trk Phi Curv Pt Phibin Wedge MWedge " << " MPhi Ptbin Iso Short Valid" << endl; } else { cout << setiosflags(ios::fixed); cout << setprecision(4) << setw(8) << Phirad() << setw(11) << setprecision(6) << Curv() << setw(8) << setprecision(2) << ( (fabs(Pt()) > 999.99) ? ( (Pt() < 0.0 ? -1 : 1) * 999.99 ) : Pt() ) << setw(6) << dec << Phi() << setw(6) << dec << Wedge() << setw(8) << dec << Miniwedge() << setw(6) << dec << Miniphi() << setw(6) << dec << Ptbin() << setw(6) << dec << (IsIsolated() ? 1 : 0) << setw(6) << dec << (IsShort() ? 1 : 0) << setw(6) << dec << (IsValid() ? 1 : 0) << endl; } } Bool_t TSvXtTrack::CalculatePt(const Bool_t shrt, const Int_t ptbin, Float_t *pt) { // Calculate Track pt from Pt bin and a lookup table. // of Pt at bin center from XFT linker specs for long and // short tracks. // Long tracks static const Float_t PtAtBin_l[] = { 1.52, 1.57, 1.63, 1.68, 1.75, 1.81, 1.88, 1.96, 2.04, 2.13, 2.23, 2.34, 2.46, 2.59, 2.74, 2.91, 3.05, 3.15, 3.25, 3.37, 3.49, 3.62, 3.76, 3.92, 4.09, 4.27, 4.47, 4.68, 4.92, 5.19, 5.49, 5.82, 6.19, 6.62, 7.11, 7.68, 8.35, 9.14, 10.11, 11.29, 12.80, 14.77, 17.45, 21.33, 27.43, 38.40, 64.00, 99.99 }; // Short tracks static const Float_t PtAtBin_s[] = { 1.57, 1.71, 1.89, 2.12, 2.40, 2.77, 3.27, 4.00, 4.80, 5.54, 6.55, 8.00, 10.29, 14.40, 24.00, 99.99 }; Bool_t illegal = kFALSE; if (!shrt) { if (ptbin > 95) { *pt = 0.; illegal = kTRUE; } *pt = (ptbin <= 47) ? -PtAtBin_l[ptbin] : PtAtBin_l[95 - ptbin]; } else { if (ptbin < 32 || ptbin > 63) { *pt = 0.; illegal = kTRUE; } *pt = (ptbin <= 47) ? -PtAtBin_s[ptbin - 32] : PtAtBin_s[63 - ptbin]; } return illegal; } Float_t TSvXtTrack::GetCurvature(const Float_t pt) { // Calculate track curvature from transverse momentum static const Float_t SCALE_PT_TO_CURV = 0.002116; return ( (fabs(pt) > 1.0e-10) ? SCALE_PT_TO_CURV / pt : (1.0e10 * (pt > 0.0) ? 1 : -1) ); }