CMS 3D CMS Logo

L1MuDTDataBuffer.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTDataBuffer
4 //
5 // Description: Data Buffer
6 //
7 //
8 //
9 // Author :
10 // N. Neumeister CERN EP
11 //
12 //--------------------------------------------------
13 
14 //-----------------------
15 // This Class's Header --
16 //-----------------------
17 
19 
20 //---------------
21 // C++ Headers --
22 //---------------
23 
24 #include <iostream>
25 #include <vector>
26 #include <cmath>
27 
28 //-------------------------------
29 // Collaborating Class Headers --
30 //-------------------------------
31 
36 
37 using namespace std;
38 
39 // --------------------------------
40 // class L1MuDTDataBuffer
41 //---------------------------------
42 
43 //----------------
44 // Constructors --
45 //----------------
47  m_sp(sp), m_tsphi(0) {
48 
49 
50  m_tsphi = new TSPhivector(38);
51  m_tsphi->reserve(38);
52 
53 }
54 
55 
56 //--------------
57 // Destructor --
58 //--------------
60 
61  delete m_tsphi;
62 
63 }
64 
65 
66 //--------------
67 // Operations --
68 //--------------
69 
70 //
71 // clear buffer
72 //
74 
75  TSPhivector::iterator iter = m_tsphi->begin();
76  while ( iter != m_tsphi->end() ) {
77  if ( *iter) {
78  delete *iter;
79  *iter = 0;
80  }
81  iter++;
82  }
83 
84 }
85 
86 
87 //
88 // get phi track segment of a given station
89 //
90 const L1MuDTTrackSegPhi* L1MuDTDataBuffer::getTSphi(int station, int reladr) const {
91 
92  int address = (station == 1) ? reladr : reladr + (station-2)*12 + 2;
93  return (*m_tsphi)[address];
94 
95 }
96 
97 
98 //
99 // add new phi track segment to the buffer
100 //
102 
103  L1MuDTTrackSegPhi* tmpts = new L1MuDTTrackSegPhi(ts);
104  (*m_tsphi)[adr] = tmpts;
105 
106 }
107 
108 
109 //
110 // print all phi track segments in the buffer
111 //
113 
114  TSPhivector::const_iterator iter = m_tsphi->begin();
115  while ( iter != m_tsphi->end() ) {
116  if ( *iter ) cout << *(*iter) << endl;
117  iter++;
118  }
119 
120 }
121 
122 
123 //
124 // count number of non empty phi track segments
125 //
127 
128  int count = 0;
129  TSPhivector::iterator iter = m_tsphi->begin();
130  while ( iter != m_tsphi->end() ) {
131  if ( *iter && !(*iter)->empty() ) count++;
132  iter++;
133  }
134  return count;
135 
136 }
void printTSphi() const
print all phi track segments which are in the buffer
L1MuDTDataBuffer(const L1MuDTSectorProcessor &)
constructor
virtual ~L1MuDTDataBuffer()
destructor
void reset()
clear Data Buffer
const TSPhivector & getTSphi() const
get all track segments from the buffer
TSPhivector * m_tsphi
int numberTSphi() const
return number of non-empty phi track segments
void addTSphi(int adr, const L1MuDTTrackSegPhi &)
add new phi track segment to the Data Buffer
std::vector< L1MuDTTrackSegPhi * > TSPhivector
container to store phi track segments
Definition: sp.h:21