00001 #include "StSectorHitFilter.h"
00002 #include "TTableSorter.h"
00003 #include "TTableIter.h"
00004
00005 #include "StTclHitChair.h"
00006
00007 #include "tables/St_tcl_tphit_Table.h"
00008 #include "tables/St_tpt_track_Table.h"
00009 #include "tables/St_dst_track_Table.h"
00010 #include "StCL.h"
00011
00012
00014
00015
00016
00017
00018
00019
00021
00022 ClassImp(StSectorHitFilter)
00023
00024
00025 Int_t StSectorHitFilter::SetSecRow(Int_t *sectorRows,Int_t n)
00026 {
00027 m_nRow = n;
00028 StCL::ucopy(sectorRows,m_row, m_nRow);
00029 printf( " # %d; ", m_nRow);
00030 if (m_nRow) printf( " Row %d", m_row[0]);
00031 printf("\n");
00032 return 0;
00033 }
00034
00035 Int_t StSectorHitFilter::Reset(Int_t reset)
00036 {
00037 printf(" bad hits = %d, # track %d\n",m_badCounter,m_trackId.size());
00038 m_Primtrk = 0;
00039 m_badCounter = 0;
00040 m_trackId.clear();
00041 return reset;
00042 }
00043
00044 Int_t StSectorHitFilter::HitSubChannel(const TTableSorter *tableObject, Int_t index,Size_t &size, Style_t &style)
00045 {
00046 Color_t color = -1;
00047 TString mStr = tableObject->GetTable()->GetName();
00048 St_tcl_tphit *hit = (St_tcl_tphit *)tableObject->GetTable();
00049 if (hit) {
00050
00051 StTclHitChair thisHit(hit);
00052 Int_t rowNumber = tableObject->GetIndex(UInt_t(index));
00053 if ( m_nRow) {
00054 UInt_t indx = UInt_t(index);
00055 for (int i =0; i < m_nRow; i++) {
00056 if (thisHit[rowNumber].row != m_row[i]) continue;
00057
00058 while (thisHit[rowNumber].row == m_row[i] && rowNumber >= 0 ) {
00059
00060 long id = thisHit[rowNumber].id_globtrk;
00061 if (id)
00062 m_trackId.insert(id);
00063 else
00064 m_badCounter++;
00065 indx++;
00066 rowNumber = tableObject->GetIndex(indx);
00067 }
00068 printf(" %d tracks have been found\n", m_trackId.size());
00069 style = 6;
00070
00071 color = 51+rowNumber%50;
00072 return color;
00073 }
00074 } else {printf(" No rows defined !!!\n"); }
00075
00076 }
00077 else
00078 Error("HitSubChannel","No hit table supplied");
00079 return 0;
00080 }
00081
00082 Int_t StSectorHitFilter::Channel(const TTableSorter *tableObject,Int_t index,Size_t &size,Style_t &style)
00083 {
00084
00085
00086
00087
00088 Color_t color = -1;
00089 TString mStr = tableObject->GetTable()->GetName();
00090
00091 if( mStr == "tphit" ) {
00092 color = HitSubChannel(tableObject,index,size,style);
00093 } else if( !m_Primtrk && mStr == "primtrk") {
00094 m_Primtrk = tableObject;
00095 }
00096 return color;
00097 }
00098
00099
00100 Int_t StSectorHitFilter::Channel(const TTable *tableObject,Int_t rowNumber,Size_t &size,Style_t &style)
00101 {
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120 static int colorIndex = 0;
00121 TString mStr = tableObject->GetType();
00122
00123 if( mStr == "dst_track_st" ) {
00124 St_dst_track &track = *((St_dst_track *)tableObject);
00125 return SubChannel(track, rowNumber, size, style);
00126 } else {
00127 St_tpt_track &track = *((St_tpt_track *)tableObject);
00128 if (!m_trackId.empty() ) {
00129 for ( set<long>::iterator i = m_trackId.begin(); i != m_trackId.end(); i++ ) {
00130 if (track[rowNumber].id != *i) continue;
00131
00132
00133 colorIndex++;
00134 if (colorIndex > 20) colorIndex = 0;
00135 return kBlue+colorIndex;
00136 }
00137 }
00138 }
00139 return 0;
00140 }
00141
00142 Int_t StSectorHitFilter::SubChannel(St_dst_track &track, Int_t rowNumber,Size_t &size,Style_t &style)
00143 {
00144
00145
00146
00147
00148
00149
00150
00151 int colorIndex = 0;
00152 if (!m_trackId.empty() ) {
00153 for ( set<long>::iterator i = m_trackId.begin(); i != m_trackId.end(); i++ ) {
00154 if (track[rowNumber].id != *i) continue;
00155 colorIndex = kYellow;
00156 if (m_Primtrk &&
00157 (*m_Primtrk)[track[rowNumber].id] < 0) colorIndex = kBlue;
00158
00159
00160 return colorIndex;
00161 }
00162 }
00163 return colorIndex;
00164 }