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
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #ifndef ST_TRS_SECTOR_HH
00055 #define ST_TRS_SECTOR_HH
00056
00057 #include <vector>
00058 #include <algorithm>
00059 #if defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x500
00060 using std::vector;
00061 #endif
00062 #include "StTrsAnalogSignal.hh"
00063 #include "StTpcGeometry.hh"
00064
00065 #include "StDbUtilities/StTpcPadCoordinate.hh"
00066
00067 typedef vector<StTrsAnalogSignal, allocator<StTrsAnalogSignal> > tpcTimeBins;
00068 typedef vector<tpcTimeBins, allocator<tpcTimeBins> > tpcPadRow;
00069 typedef vector<tpcPadRow, allocator<tpcPadRow> > tpcSector;
00070
00071 typedef vector<StTrsAnalogSignal, allocator<StTrsAnalogSignal> >::iterator timeBinIterator;
00072
00073 typedef tpcPadRow::iterator padRowIterator;
00074 typedef tpcSector::iterator rowIterator;
00075
00076 class StTrsSector {
00077 public:
00078 StTrsSector(StTpcGeometry*);
00079 ~StTrsSector();
00080
00081
00082
00083
00084
00085 tpcTimeBins& timeBinsOfRowAndPad(int, int);
00086 tpcPadRow& padsOfRow(int);
00087 tpcSector& rows();
00088
00089 int size() const;
00090 int numberOfRows() const;
00091 int numberOfPadsInRow(int) const;
00092
00093
00094 void clear();
00095 void addEntry(StTpcPadCoordinate&, StTrsAnalogSignal&);
00096 void addEntry(int, int, StTrsAnalogSignal&);
00097
00098 void assignTimeBins(int, int, tpcTimeBins&);
00099 void assignTimeBins(StTpcPadCoordinate&, tpcTimeBins&);
00100 int sort();
00101
00102 private:
00103 tpcSector mSector;
00104 };
00105 inline tpcTimeBins& StTrsSector::timeBinsOfRowAndPad(int rowN, int padN) { return (mSector[(rowN-1)][(padN-1)]); }
00106 inline tpcPadRow& StTrsSector::padsOfRow(int rowN) { return (mSector[(rowN-1)]); }
00107 inline tpcSector& StTrsSector::rows() { return (mSector); }
00108 inline int StTrsSector::size() const { return mSector.size();}
00109 inline int StTrsSector::numberOfRows() const { return mSector.size();}
00110 inline int StTrsSector::numberOfPadsInRow(int rowN) const { return mSector[(rowN-1)].size();}
00111 inline void StTrsSector::addEntry(int rowN, int padN, StTrsAnalogSignal& signl)
00112 {
00113
00114 #ifdef ST_SECTOR_BOUNDS_CHECK
00115 if( (rowN > 0 && row <= mSector.size()) )
00116 if( (padN > 0 && pad <= mSector[(rowN-1)].size()) )
00117 #endif
00118 mSector[(rowN-1)][(padN-1)].push_back(signl);
00119 }
00120 inline void StTrsSector::assignTimeBins(int rowN, int padN, tpcTimeBins& tbins)
00121 {
00122 #ifdef ST_SECTOR_BOUNDS_CHECK
00123 if( (rowIndex > 0 && rowIndex <= mSector.size()) )
00124 if( (padIndex > 0 && padIndex <= mSector[rowIndex].size()) )
00125 #endif
00126 mSector[(rowN-1)][(padN-1)] = tbins;
00127 }
00128
00129 #endif