CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuDTDataBuffer.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTDataBuffer
4 //
5 // Description: Data Buffer
6 //
7 //
8 // $Date: 2007/02/27 11:44:00 $
9 // $Revision: 1.2 $
10 //
11 // Author :
12 // N. Neumeister CERN EP
13 //
14 //--------------------------------------------------
15 
16 //-----------------------
17 // This Class's Header --
18 //-----------------------
19 
21 
22 //---------------
23 // C++ Headers --
24 //---------------
25 
26 #include <iostream>
27 #include <vector>
28 #include <cmath>
29 
30 //-------------------------------
31 // Collaborating Class Headers --
32 //-------------------------------
33 
38 
39 using namespace std;
40 
41 // --------------------------------
42 // class L1MuDTDataBuffer
43 //---------------------------------
44 
45 //----------------
46 // Constructors --
47 //----------------
49  m_sp(sp), m_tsphi(0) {
50 
51 
52  m_tsphi = new TSPhivector(38);
53  m_tsphi->reserve(38);
54 
55 }
56 
57 
58 //--------------
59 // Destructor --
60 //--------------
62 
63  delete m_tsphi;
64 
65 }
66 
67 
68 //--------------
69 // Operations --
70 //--------------
71 
72 //
73 // clear buffer
74 //
76 
77  TSPhivector::iterator iter = m_tsphi->begin();
78  while ( iter != m_tsphi->end() ) {
79  if ( *iter) {
80  delete *iter;
81  *iter = 0;
82  }
83  iter++;
84  }
85 
86 }
87 
88 
89 //
90 // get phi track segment of a given station
91 //
92 const L1MuDTTrackSegPhi* L1MuDTDataBuffer::getTSphi(int station, int reladr) const {
93 
94  int address = (station == 1) ? reladr : reladr + (station-2)*12 + 2;
95  return (*m_tsphi)[address];
96 
97 }
98 
99 
100 //
101 // add new phi track segment to the buffer
102 //
104 
105  L1MuDTTrackSegPhi* tmpts = new L1MuDTTrackSegPhi(ts);
106  (*m_tsphi)[adr] = tmpts;
107 
108 }
109 
110 
111 //
112 // print all phi track segments in the buffer
113 //
115 
116  TSPhivector::const_iterator iter = m_tsphi->begin();
117  while ( iter != m_tsphi->end() ) {
118  if ( *iter ) cout << *(*iter) << endl;
119  iter++;
120  }
121 
122 }
123 
124 
125 //
126 // count number of non empty phi track segments
127 //
129 
130  int count = 0;
131  TSPhivector::iterator iter = m_tsphi->begin();
132  while ( iter != m_tsphi->end() ) {
133  if ( *iter && !(*iter)->empty() ) count++;
134  iter++;
135  }
136  return count;
137 
138 }
char * address
Definition: mlp_lapack.h:14
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
tuple cout
Definition: gather_cfg.py:121