00001 #ifndef STAR_StTclHitChair
00002 #define STAR_StTclHitChair
00003 #ifdef __CC5__
00004 #include <TChair.h>
00005 #else
00006 #include "TChair.h"
00007 #endif
00009 // This chair privides the custom methods to the packed
00010
00011
00012
00013
00015
00016 #include "tables/St_tcl_tphit_Table.h"
00017
00018 class StTclHitChair : public TChair {
00019 protected:
00020 StTclHitChair() {;}
00021 public:
00022 StTclHitChair(St_tcl_tphit *hits): TChair(hits){;}
00023 ~StTclHitChair(){;}
00024
00025 static Long_t GetTrackFactor();
00026 static UShort_t GetSectorFactor();
00027 static UShort_t UpckSec(UShort_t row);
00028 static UShort_t UpckRow(UShort_t row);
00029 static Long_t UpckTrackId (Long_t track);
00030 static Long_t UpckPosition(Long_t track);
00031 static Long_t PckTrack(Long_t trackId, Long_t position);
00032 static UShort_t PckRow(UShort_t sector,UShort_t row);
00033
00034 UShort_t Sector(Int_t i) const;
00035 UShort_t PadRow(Int_t i) const;
00036 Long_t TrackId(Int_t i) const;
00037 Long_t Position(Int_t i) const;
00038 Bool_t IsValid(Int_t i) const;
00039 tcl_tphit_st *Table(Int_t i=0) const;
00040 tcl_tphit_st &operator[](Int_t i){return *Table(i);}
00041
00042 UShort_t SectorRow(Int_t i,UShort_t sector,UShort_t row);
00043 Long_t IdPosition(Int_t i, Long_t track_Id, Long_t position);
00044
00045 ClassDef(StTclHitChair,0)
00046 };
00047
00048 inline Long_t StTclHitChair::GetTrackFactor()
00049 { return 1000;}
00050
00051 inline UShort_t StTclHitChair::GetSectorFactor()
00052 { return 100;}
00053
00054 inline UShort_t StTclHitChair::UpckSec(UShort_t row)
00055 { return row / GetSectorFactor() ;}
00056
00057 inline UShort_t StTclHitChair::UpckRow(UShort_t row)
00058 { return row - UpckSec(row)*GetSectorFactor() ;}
00059
00060 inline Long_t StTclHitChair::UpckTrackId(Long_t track)
00061 { return track/GetTrackFactor();}
00062
00063 inline Long_t StTclHitChair::UpckPosition(Long_t track)
00064 { return track - UpckTrackId(track)*GetTrackFactor();}
00065
00066 inline Long_t StTclHitChair::PckTrack(Long_t trackId, Long_t position)
00067 { return trackId*GetTrackFactor() + position; }
00068
00069 inline UShort_t StTclHitChair::PckRow(UShort_t sector,UShort_t row)
00070 { return sector*GetSectorFactor() + row;}
00071
00072 inline tcl_tphit_st *StTclHitChair::Table(Int_t i) const { return ((St_tcl_tphit *)GetTable())->GetTable(i);}
00073
00074 inline UShort_t StTclHitChair::Sector(Int_t i) const { return UpckSec(Table(i)->row);}
00075 inline UShort_t StTclHitChair::PadRow(Int_t i) const { return UpckRow(Table(i)->row);}
00076 inline Long_t StTclHitChair::TrackId(Int_t i) const { return UpckTrackId(Table(i)->track);}
00077 inline Long_t StTclHitChair::Position(Int_t i) const { return UpckPosition(Table(i)->track);}
00078
00079
00080 inline Bool_t StTclHitChair::IsValid(Int_t i) const {return (Table(i)->z)*(Sector(i)-12.5) <= 0 ? kTRUE : kFALSE; }
00081
00082 inline UShort_t StTclHitChair::SectorRow(Int_t i, UShort_t sector,UShort_t row)
00083 { return Table(i)->row = PckRow(sector,row); }
00084
00085 inline Long_t StTclHitChair::IdPosition(Int_t i, Long_t trackId, Long_t position)
00086 {return Table(i)->track = PckTrack(trackId,position);}
00087
00088 #endif
00089