CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
L1MuGMTMatrix< T > Class Template Reference

#include <L1MuGMTMatrix.h>

Public Member Functions

int colAny (int c) const
 is any element in column c > 0 ? return index or -1 More...
 
void init (T v=0)
 initialize matrix More...
 
bool isMax (int r, int c) const
 is the element (r,c) the max. entry in its row and column? More...
 
bool isMin (int r, int c) const
 is the element (r,c) the min. entry in its row and column? More...
 
 L1MuGMTMatrix (int r, int c)
 constructor More...
 
 L1MuGMTMatrix (const L1MuGMTMatrix< T > &)
 copy constructor More...
 
Toperator() (int r, int c)
 
const Toperator() (int r, int c) const
 
L1MuGMTMatrixoperator*= (const T &s)
 scalar multiplication More...
 
L1MuGMTMatrixoperator+= (const L1MuGMTMatrix &m)
 matrix addition More...
 
L1MuGMTMatrixoperator+= (const T &s)
 scalar addition More...
 
L1MuGMTMatrixoperator= (const L1MuGMTMatrix &m)
 assignment operator More...
 
void print () const
 print matrix More...
 
int rowAny (int r) const
 is any element in row r > 0 ? return index or -1 More...
 
void set (int r, int c, T v)
 set matrix element More...
 
virtual ~L1MuGMTMatrix ()
 destructor More...
 

Private Attributes

int c_size
 
T ** p
 
int r_size
 

Detailed Description

template<class T>
class L1MuGMTMatrix< T >

Matrix.

general matrix

Definition at line 47 of file L1MuGMTMatrix.h.

Constructor & Destructor Documentation

template<class T >
L1MuGMTMatrix< T >::L1MuGMTMatrix ( int  r,
int  c 
)

constructor

Definition at line 109 of file L1MuGMTMatrix.h.

References assert(), EnergyCorrector::c, i, L1MuGMTMatrix< T >::p, and alignCSCRings::r.

109  : r_size(r), c_size(c) {
110 
111  p = new T*[r];
112 
113  assert(p != 0);
114 
115  for (int i = 0; i < r; i++) {
116  p[i] = new T[c];
117  assert(p[i] != 0);
118  }
119 
120 }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
long double T
template<class T>
L1MuGMTMatrix< T >::L1MuGMTMatrix ( const L1MuGMTMatrix< T > &  mat)

copy constructor

Definition at line 126 of file L1MuGMTMatrix.h.

References assert(), L1MuGMTMatrix< T >::c_size, i, j, L1MuGMTMatrix< T >::p, and L1MuGMTMatrix< T >::r_size.

126  : r_size(mat.r_size), c_size(mat.c_size) {
127 
128  p = new T*[r_size];
129 
130  assert(p != 0);
131 
132  for (int i = 0; i < r_size; i++) {
133  p[i] = new T[c_size];
134  assert(p[i] != 0);
135  for (int j = 0; j < c_size; j++) p[i][j] = mat.p[i][j];
136  }
137 
138 }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
int j
Definition: DBlmapReader.cc:9
long double T
template<class T >
L1MuGMTMatrix< T >::~L1MuGMTMatrix ( )
virtual

destructor

Definition at line 145 of file L1MuGMTMatrix.h.

References i, and AlCaHLTBitMon_ParallelJobs::p.

145  {
146 
147  for (int i = 0; i < r_size; i++) {
148  delete [] p[i];
149  }
150 
151  delete [] p;
152 
153 }
int i
Definition: DBlmapReader.cc:9

Member Function Documentation

template<class T >
int L1MuGMTMatrix< T >::colAny ( int  c) const

is any element in column c > 0 ? return index or -1

Definition at line 326 of file L1MuGMTMatrix.h.

References i, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by L1MuGMTCancelOutUnit::decide(), and L1MuGMTMerger::merge().

326  {
327 
328  int stat = -1;
329  for (int i = 0; i < r_size; i++) {
330  if ( this->p[i][c] > 0 ) stat = i;
331  }
332 
333  return stat;
334 
335 }
int i
Definition: DBlmapReader.cc:9
template<class T>
void L1MuGMTMatrix< T >::init ( T  v = 0)

initialize matrix

Definition at line 186 of file L1MuGMTMatrix.h.

References EnergyCorrector::c, AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

Referenced by L1MuGMTInputEvent::L1MuGMTInputEvent(), L1MuGMTPSB::L1MuGMTPSB(), L1MuGMTMatcher::match(), L1MuGMTInputEvent::reset(), L1MuGMTMatcher::reset(), and L1MuGMTPSB::reset().

186  {
187 
188  for (int r = 0; r < r_size; r++) {
189  for (int c = 0; c < c_size; c++) p[r][c] = v;
190  }
191 
192 }
template<class T >
bool L1MuGMTMatrix< T >::isMax ( int  r,
int  c 
) const

is the element (r,c) the max. entry in its row and column?

Definition at line 280 of file L1MuGMTMatrix.h.

References EnergyCorrector::c, i, j, bookConverter::max, AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

Referenced by L1MuGMTMatcher::match().

280  {
281 
282  bool max = true;
283 
284  for (int i = 0; i < c; i++) {
285  max = max && ( this->p[r][c] > this->p[r][i]);
286  }
287  for (int i = c+1; i < c_size; i++) {
288  max = max && ( this->p[r][c] >= this->p[r][i]);
289  }
290 
291  for (int j = 0; j < r; j++) {
292  max = max && ( this->p[r][c] > this->p[j][c]);
293  }
294  for (int j = r+1; j < r_size; j++) {
295  max = max && ( this->p[r][c] >= this->p[j][c]);
296  }
297 
298  return max;
299 
300 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
template<class T >
bool L1MuGMTMatrix< T >::isMin ( int  r,
int  c 
) const

is the element (r,c) the min. entry in its row and column?

Definition at line 307 of file L1MuGMTMatrix.h.

References EnergyCorrector::c, i, j, min(), AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

307  {
308 
309  bool min = true;
310  for (int i = 0; i < c_size; i++) {
311  min = min && ( this->p[r][c] <= this->p[r][i]);
312  }
313  for (int j = 0; j < r_size; j++) {
314  min = min && ( this->p[r][c] <= this->p[j][c]);
315  }
316 
317  return min;
318 
319 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
T min(T a, T b)
Definition: MathUtil.h:58
template<class T >
T & L1MuGMTMatrix< T >::operator() ( int  r,
int  c 
)

Definition at line 160 of file L1MuGMTMatrix.h.

References assert(), EnergyCorrector::c, AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

160  {
161 
162  assert( r >= 0 && r < r_size && c >= 0 && c < c_size );
163 
164  return p[r][c];
165 
166 }
assert(m_qm.get())
template<class T >
const T & L1MuGMTMatrix< T >::operator() ( int  r,
int  c 
) const

Definition at line 173 of file L1MuGMTMatrix.h.

References assert(), EnergyCorrector::c, AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

173  {
174 
175  assert( r >= 0 && r < r_size && c >= 0 && c < c_size );
176 
177  return p[r][c];
178 
179 }
assert(m_qm.get())
template<class T>
L1MuGMTMatrix< T > & L1MuGMTMatrix< T >::operator*= ( const T s)

scalar multiplication

Definition at line 265 of file L1MuGMTMatrix.h.

References EnergyCorrector::c, AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

265  {
266 
267  for (int r = 0; r < r_size; r++) {
268  for (int c = 0; c < c_size; c++) p[r][c] *= s;
269  }
270 
271  return *this;
272 
273 }
template<class T >
L1MuGMTMatrix< T > & L1MuGMTMatrix< T >::operator+= ( const L1MuGMTMatrix< T > &  m)

matrix addition

Definition at line 231 of file L1MuGMTMatrix.h.

References assert(), EnergyCorrector::c, L1MuGMTMatrix< T >::c_size, L1MuGMTMatrix< T >::p, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, and L1MuGMTMatrix< T >::r_size.

231  {
232 
233  assert(m.c_size == c_size && m.r_size == r_size);
234 
235  for (int r = 0; r < r_size; r++) {
236  for (int c = 0; c < c_size; c++) {
237  p[r][c] += m.p[r][c];
238  }
239  }
240 
241  return *this;
242 
243 }
assert(m_qm.get())
template<class T>
L1MuGMTMatrix< T > & L1MuGMTMatrix< T >::operator+= ( const T s)

scalar addition

Definition at line 250 of file L1MuGMTMatrix.h.

References EnergyCorrector::c, AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

250  {
251 
252  for (int r = 0; r < r_size; r++) {
253  for (int c = 0; c < c_size; c++) p[r][c] += s;
254  }
255 
256  return *this;
257 
258 }
template<class T >
L1MuGMTMatrix< T > & L1MuGMTMatrix< T >::operator= ( const L1MuGMTMatrix< T > &  m)

assignment operator

Definition at line 212 of file L1MuGMTMatrix.h.

References assert(), EnergyCorrector::c, L1MuGMTMatrix< T >::c_size, L1MuGMTMatrix< T >::p, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, and L1MuGMTMatrix< T >::r_size.

212  {
213 
214  if ( this != &m ) {
215  assert(m.c_size == c_size && m.r_size == r_size);
216 
217  for (int r = 0; r < r_size; r++) {
218  for (int c = 0; c < c_size; c++) p[r][c] = m.p[r][c];
219  }
220  }
221 
222  return (*this);
223 
224 }
assert(m_qm.get())
template<class T >
void L1MuGMTMatrix< T >::print ( void  ) const

print matrix

Definition at line 358 of file L1MuGMTMatrix.h.

References EnergyCorrector::c, convertSQLitetoXML_cfg::output, AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

Referenced by L1MuGMTMatcher::print().

358  {
359 
360  for (int r = 0; r < r_size; r++) {
361  std::stringstream output;
362  for (int c = 0; c < c_size; c++) output << p[r][c] << "\t";
363  edm::LogVerbatim("GMTMatrix_print") << output.str();
364  }
365  edm::LogVerbatim("GMTMatrix_print");
366 
367 }
template<class T >
int L1MuGMTMatrix< T >::rowAny ( int  r) const

is any element in row r > 0 ? return index or -1

Definition at line 342 of file L1MuGMTMatrix.h.

References i, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by L1MuGMTCancelOutUnit::decide(), and L1MuGMTMerger::merge().

342  {
343 
344  int stat = -1;
345  for (int i = 0; i < c_size; i++) {
346  if ( this->p[r][i] > 0 ) stat = i;
347  }
348 
349  return stat;
350 
351 }
int i
Definition: DBlmapReader.cc:9
template<class T>
void L1MuGMTMatrix< T >::set ( int  r,
int  c,
T  v 
)

set matrix element

Definition at line 199 of file L1MuGMTMatrix.h.

References assert(), EnergyCorrector::c, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, and findQualityFiles::v.

Referenced by L1MuGMTPSB::getCalo(), and betterConfigParser.BetterConfigParser::getGeneral().

199  {
200 
201  assert( r >= 0 && r < r_size && c >= 0 && c < c_size );
202 
203  p[r][c] = v;
204 
205 }
assert(m_qm.get())

Member Data Documentation

template<class T>
int L1MuGMTMatrix< T >::c_size
private
template<class T>
T** L1MuGMTMatrix< T >::p
private
template<class T>
int L1MuGMTMatrix< T >::r_size
private