CMS 3D CMS Logo

L1MuBMDataBuffer.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuBMDataBuffer
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 L1MuBMDataBuffer
41 //---------------------------------
42 
43 //----------------
44 // Constructors --
45 //----------------
46 L1MuBMDataBuffer::L1MuBMDataBuffer(const L1MuBMSectorProcessor& 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 L1MuBMTrackSegPhi* L1MuBMDataBuffer::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  L1MuBMTrackSegPhi* tmpts = new L1MuBMTrackSegPhi(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 }
L1MuBMDataBuffer::getTSphi
const TSPhivector & getTSphi() const
get all track segments from the buffer
Definition: L1MuBMDataBuffer.h:56
L1MuBMTrackSegPhi
Definition: L1MuBMTrackSegPhi.h:41
relativeConstraints.station
station
Definition: relativeConstraints.py:67
L1MuBMDataBuffer::m_tsphi
TSPhivector * m_tsphi
Definition: L1MuBMDataBuffer.h:72
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1MuBMDataBuffer::L1MuBMDataBuffer
L1MuBMDataBuffer(const L1MuBMSectorProcessor &)
constructor
Definition: L1MuBMDataBuffer.cc:46
L1MuBMTrackSegPhi.h
L1MuBMDataBuffer::~L1MuBMDataBuffer
virtual ~L1MuBMDataBuffer()
destructor
Definition: L1MuBMDataBuffer.cc:54
L1MuBMSectorProcessor
Definition: L1MuBMSectorProcessor.h:54
L1MuBMTrackSegLoc.h
L1MuBMDataBuffer::printTSphi
void printTSphi() const
print all phi track segments which are in the buffer
Definition: L1MuBMDataBuffer.cc:93
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
L1MuBMTFConfig.h
L1MuBMDataBuffer::addTSphi
void addTSphi(int adr, const L1MuBMTrackSegPhi &)
add new phi track segment to the Data Buffer
Definition: L1MuBMDataBuffer.cc:85
std
Definition: JetResolutionObject.h:76
L1MuBMDataBuffer::numberTSphi
int numberTSphi() const
return number of non-empty phi track segments
Definition: L1MuBMDataBuffer.cc:105
L1MuBMDataBuffer.h
L1MuBMDataBuffer::reset
void reset()
clear Data Buffer
Definition: L1MuBMDataBuffer.cc:63
L1MuBMDataBuffer::TSPhivector
std::vector< L1MuBMTrackSegPhi * > TSPhivector
container to store phi track segments
Definition: L1MuBMDataBuffer.h:44
L1MuBMSectorProcessor.h