Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:14

0001 //-------------------------------------------------
0002 //
0003 //   Class: L1MuGMTDebugBlock
0004 //
0005 //
0006 //
0007 //   Author :
0008 //   H. Sakulin                HEPHY Vienna
0009 //
0010 //   Migrated to CMSSW:
0011 //   I. Mikulec
0012 //
0013 //--------------------------------------------------
0014 
0015 //-----------------------
0016 // This Class's Header --
0017 //-----------------------
0018 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTDebugBlock.h"
0019 
0020 //---------------
0021 // C++ Headers --
0022 //---------------
0023 
0024 #include <iostream>
0025 #include <vector>
0026 #include <cmath>
0027 
0028 using namespace std;
0029 
0030 //----------------
0031 // Constructors --
0032 //----------------
0033 
0034 L1MuGMTDebugBlock::L1MuGMTDebugBlock(int minbx, int maxbx)
0035     : _minbx(minbx),
0036       _maxbx(maxbx),
0037       _bx(_minbx),
0038       _prophi(maxbx - minbx + 1, std::vector<float>(32, 0)),
0039       _proeta(maxbx - minbx + 1, std::vector<float>(32, 0)),
0040       _phisel(maxbx - minbx + 1, std::vector<unsigned>(32, 0)),
0041       _etasel(maxbx - minbx + 1, std::vector<unsigned>(32, 0)),
0042       _isMIPISO(maxbx - minbx + 1, std::vector<unsigned>(32, 0)),
0043       _pairMatrices(maxbx - minbx + 1,
0044                     std::vector<L1MuGMTMatrix<bool> >(NumMatrices, L1MuGMTMatrix<bool>(4, 4, false))),
0045       _mqMatrices(maxbx - minbx + 1, std::vector<L1MuGMTMatrix<int> >(NumMatrices, L1MuGMTMatrix<int>(4, 4, 0))),
0046       _cancelbits(maxbx - minbx + 1, std::vector<unsigned>(4)),
0047       _brlmuons(maxbx - minbx + 1, std::vector<L1MuGMTExtendedCand>(4)),
0048       _fwdmuons(maxbx - minbx + 1, std::vector<L1MuGMTExtendedCand>(4))
0049 // will not work w/o copy constructor
0050 {
0051   if (maxbx < minbx)
0052     edm::LogWarning("BxRangeMismatch") << "*** error in L1MuGMTDebugBlock::L1MuGMTDebugBlock(): minbx > maxbx" << endl;
0053   reset();
0054 }
0055 
0056 //--------------
0057 // Destructor --
0058 //--------------
0059 
0060 L1MuGMTDebugBlock::~L1MuGMTDebugBlock() {
0061   for (int bx = 0; bx <= (_maxbx - _minbx); bx++) {
0062     _prophi[bx].clear();
0063     _proeta[bx].clear();
0064     _phisel[bx].clear();
0065     _etasel[bx].clear();
0066     _isMIPISO[bx].clear();
0067     _brlmuons[bx].clear();
0068     _fwdmuons[bx].clear();
0069   }
0070   _prophi.clear();
0071   _proeta.clear();
0072   _phisel.clear();
0073   _etasel.clear();
0074   _isMIPISO.clear();
0075   _pairMatrices.clear();
0076   _mqMatrices.clear();
0077   _brlmuons.clear();
0078   _fwdmuons.clear();
0079 }
0080 
0081 void L1MuGMTDebugBlock::SetCancelBits(int idx, const std::vector<bool>& mine, const vector<bool>& others) {
0082   unsigned bits = 0;
0083   unsigned mask = 1;
0084 
0085   for (int i = 0; i < 4; i++) {
0086     if (mine[i])
0087       bits |= mask;
0088     mask = mask << 1;
0089   }
0090   for (int i = 0; i < 4; i++) {
0091     if (others[i])
0092       bits |= mask;
0093     mask = mask << 1;
0094   }
0095   _cancelbits[_bx - _minbx][idx] = bits;
0096 }
0097 
0098 //--------------
0099 // Operations --
0100 //--------------
0101 
0102 void L1MuGMTDebugBlock::reset() {
0103   _bx = _minbx;
0104   for (int bx = 0; bx < _maxbx - _minbx + 1; bx++) {
0105     for (int i = 0; i < 32; i++) {
0106       _prophi[bx][i] = _proeta[bx][i] = 99.;
0107       _phisel[bx][i] = _etasel[bx][i] = 0;
0108       _isMIPISO[bx][i] = 0;
0109     }
0110     for (int i = 0; i < NumMatrices; i++) {
0111       _pairMatrices[bx][i].reset(false);
0112       _mqMatrices[bx][i].reset(0);
0113     }
0114     for (int i = 0; i < 4; i++) {
0115       _brlmuons[bx][i].reset();
0116       _fwdmuons[bx][i].reset();
0117     }
0118   }
0119 }