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 //----------------
46 L1MuDTDataBuffer::L1MuDTDataBuffer(const L1MuDTSectorProcessor& sp) : m_sp(sp), m_tsphi(nullptr) {
47  m_tsphi = new TSPhivector(38);
48  m_tsphi->reserve(38);
49 }
50 
51 //--------------
52 // Destructor --
53 //--------------
55 
56 //--------------
57 // Operations --
58 //--------------
59 
60 //
61 // clear buffer
62 //
64  TSPhivector::iterator iter = m_tsphi->begin();
65  while (iter != m_tsphi->end()) {
66  if (*iter) {
67  delete *iter;
68  *iter = nullptr;
69  }
70  iter++;
71  }
72 }
73 
74 //
75 // get phi track segment of a given station
76 //
77 const L1MuDTTrackSegPhi* L1MuDTDataBuffer::getTSphi(int station, int reladr) const {
78  int address = (station == 1) ? reladr : reladr + (station - 2) * 12 + 2;
79  return (*m_tsphi)[address];
80 }
81 
82 //
83 // add new phi track segment to the buffer
84 //
86  L1MuDTTrackSegPhi* tmpts = new L1MuDTTrackSegPhi(ts);
87  (*m_tsphi)[adr] = tmpts;
88 }
89 
90 //
91 // print all phi track segments in the buffer
92 //
94  TSPhivector::const_iterator iter = m_tsphi->begin();
95  while (iter != m_tsphi->end()) {
96  if (*iter)
97  cout << *(*iter) << endl;
98  iter++;
99  }
100 }
101 
102 //
103 // count number of non empty phi track segments
104 //
106  int count = 0;
107  TSPhivector::iterator iter = m_tsphi->begin();
108  while (iter != m_tsphi->end()) {
109  if (*iter && !(*iter)->empty())
110  count++;
111  iter++;
112  }
113  return count;
114 }
L1MuDTTFConfig.h
relativeConstraints.station
station
Definition: relativeConstraints.py:67
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1MuDTSectorProcessor.h
L1MuDTDataBuffer::m_tsphi
TSPhivector * m_tsphi
Definition: L1MuDTDataBuffer.h:72
L1MuDTDataBuffer::TSPhivector
std::vector< L1MuDTTrackSegPhi * > TSPhivector
container to store phi track segments
Definition: L1MuDTDataBuffer.h:44
L1MuDTTrackSegPhi.h
L1MuDTDataBuffer::addTSphi
void addTSphi(int adr, const L1MuDTTrackSegPhi &)
add new phi track segment to the Data Buffer
Definition: L1MuDTDataBuffer.cc:85
L1MuDTTrackSegLoc.h
L1MuDTDataBuffer::numberTSphi
int numberTSphi() const
return number of non-empty phi track segments
Definition: L1MuDTDataBuffer.cc:105
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
L1MuDTDataBuffer.h
L1MuDTDataBuffer::L1MuDTDataBuffer
L1MuDTDataBuffer(const L1MuDTSectorProcessor &)
constructor
Definition: L1MuDTDataBuffer.cc:46
L1MuDTSectorProcessor
Definition: L1MuDTSectorProcessor.h:53
std
Definition: JetResolutionObject.h:76
L1MuDTDataBuffer::~L1MuDTDataBuffer
virtual ~L1MuDTDataBuffer()
destructor
Definition: L1MuDTDataBuffer.cc:54
L1MuDTDataBuffer::reset
void reset()
clear Data Buffer
Definition: L1MuDTDataBuffer.cc:63
L1MuDTDataBuffer::printTSphi
void printTSphi() const
print all phi track segments which are in the buffer
Definition: L1MuDTDataBuffer.cc:93
L1MuDTTrackSegPhi
Definition: L1MuDTTrackSegPhi.h:36
L1MuDTDataBuffer::getTSphi
const TSPhivector & getTSphi() const
get all track segments from the buffer
Definition: L1MuDTDataBuffer.h:56