StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTrsSector.hh
1 /***************************************************************************
2  *
3  * $Id: StTrsSector.hh,v 1.8 2012/06/11 15:04:55 fisyak Exp $
4  *
5  * Author: bl prelim
6  ***************************************************************************
7  *
8  * Description: Keeps the analog (and later) digital information
9  * in the sector's time bins
10  *
11  ***************************************************************************
12  *
13  * $Log: StTrsSector.hh,v $
14  * Revision 1.8 2012/06/11 15:04:55 fisyak
15  * std namespace
16  *
17  * Revision 1.7 2005/10/19 21:42:23 perev
18  * Add include <algorith> for sort
19  *
20  * Revision 1.6 2005/09/09 22:12:48 perev
21  * Bug fix + IdTruth added
22  *
23  * Revision 1.5 2000/06/23 00:12:24 snelling
24  * Removed dependence on local files now pointed to StDbUtilities
25  *
26  * Revision 1.4 2000/01/10 23:11:32 lasiuk
27  * Include MACROS for compatibility with SUN CC5.0
28  *
29  * Revision 1.3 1999/11/11 19:45:02 calderon
30  * Made variables-> data members in analog signal generator to avoid
31  * initialization time when member functions are called.
32  * Inlined:
33  * StTrsParameterizedAnalogSignalGenerator::signalSampler()
34  * StTrsSector::addEntry()
35  * StTrsSector::assignTimeBins()
36  *
37  * Revision 1.2 1999/01/18 21:03:32 lasiuk
38  * Jan 18,1999
39  *
40  * Revision 1.1 1998/11/10 17:12:12 fisyak
41  * Put Brian trs versin into StRoot
42  *
43  * Revision 1.3 1998/11/08 17:06:33 lasiuk
44  * use resize() for LINUX compatibiltiy
45  * allocator specification for vector<>
46  *
47  * Revision 1.2 1998/11/04 18:49:26 lasiuk
48  * modify constructors
49  * macro ST_SECTOR_BOUND_CHECK
50  * addEntry()
51  * addTimeBins()
52  *
53  * Revision 1.1 1998/06/30 22:54:10 lasiuk
54  * Initial Revision
55  *
56  **************************************************************************/
57 #ifndef ST_TRS_SECTOR_HH
58 #define ST_TRS_SECTOR_HH
59 
60 #include <vector>
61 #include <algorithm>
62 using std::vector;
63 #include "StTrsAnalogSignal.hh"
64 #include "StTpcGeometry.hh"
65 
66 #include "StDbUtilities/StTpcPadCoordinate.hh"
67 
68 typedef std::vector<StTrsAnalogSignal, std::allocator<StTrsAnalogSignal> > tpcTimeBins;
69 typedef std::vector<tpcTimeBins, std::allocator<tpcTimeBins> > tpcPadRow;
70 typedef std::vector<tpcPadRow, std::allocator<tpcPadRow> > tpcSector;
71 
72 typedef std::vector<StTrsAnalogSignal, std::allocator<StTrsAnalogSignal> >::iterator timeBinIterator;
73 
74 typedef tpcPadRow::iterator padRowIterator;
75 typedef tpcSector::iterator rowIterator;
76 
77 class StTrsSector {
78 public:
80  ~StTrsSector();
81 
82  //StTrsSector(const StTrsSector&);
83  //StTrsSector& operator=(const StTrsSector&);
84 
85  // access functions
86  tpcTimeBins& timeBinsOfRowAndPad(int, int);
87  tpcPadRow& padsOfRow(int);
88  tpcSector& rows();
89 
90  int size() const;
91  int numberOfRows() const;
92  int numberOfPadsInRow(int) const;
93 
94  // Adding
95  void clear();
96  void addEntry(StTpcPadCoordinate&, StTrsAnalogSignal&);
97  void addEntry(int, int, StTrsAnalogSignal&); // row,pad
98 
99  void assignTimeBins(int, int, tpcTimeBins&);
100  void assignTimeBins(StTpcPadCoordinate&, tpcTimeBins&);
101  int sort();
102 
103 private:
104  tpcSector mSector;
105 };
106 inline tpcTimeBins& StTrsSector::timeBinsOfRowAndPad(int rowN, int padN) { return (mSector[(rowN-1)][(padN-1)]); }
107 inline tpcPadRow& StTrsSector::padsOfRow(int rowN) { return (mSector[(rowN-1)]); }
108 inline tpcSector& StTrsSector::rows() { return (mSector); }
109 inline int StTrsSector::size() const { return mSector.size();}
110 inline int StTrsSector::numberOfRows() const { return mSector.size();}
111 inline int StTrsSector::numberOfPadsInRow(int rowN) const { return mSector[(rowN-1)].size();}
112 inline void StTrsSector::addEntry(int rowN, int padN, StTrsAnalogSignal& signl)
113 {
114 
115 #ifdef ST_SECTOR_BOUNDS_CHECK
116  if( (rowN > 0 && row <= mSector.size()) )
117  if( (padN > 0 && pad <= mSector[(rowN-1)].size()) )
118 #endif
119  mSector[(rowN-1)][(padN-1)].push_back(signl);
120 }
121 inline void StTrsSector::assignTimeBins(int rowN, int padN, tpcTimeBins& tbins)
122 {
123 #ifdef ST_SECTOR_BOUNDS_CHECK
124  if( (rowIndex > 0 && rowIndex <= mSector.size()) )
125  if( (padIndex > 0 && padIndex <= mSector[rowIndex].size()) )
126 #endif
127  mSector[(rowN-1)][(padN-1)] = tbins;
128 }
129 
130 #endif