Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:56

0001 //-------------------------------------------------
0002 //
0003 //   \class L1MuGMTDebugBlock
0004 /**
0005  *   Description: debug block for GMT
0006  *                it is filled during GMT processing
0007  *                and allows to retrieve intermediate 
0008  *                results, later (e.g. for comparison
0009  *                with the hardware model)
0010 */
0011 //
0012 //
0013 //   Author :
0014 //   H. Sakulin            HEPHY Vienna
0015 //
0016 //   Migrated to CMSSW:
0017 //   I. Mikulec
0018 //
0019 //--------------------------------------------------
0020 #ifndef L1TriggerGlobalMuonTrigger_L1MuGMTDebugBlock_h
0021 #define L1TriggerGlobalMuonTrigger_L1MuGMTDebugBlock_h
0022 
0023 //---------------
0024 // C++ Headers --
0025 //---------------
0026 
0027 #include <vector>
0028 
0029 //----------------------
0030 // Base Class Headers --
0031 //----------------------
0032 
0033 //------------------------------------
0034 // Collaborating Class Declarations --
0035 //------------------------------------
0036 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMatrix.h"
0037 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTExtendedCand.h"
0038 
0039 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0040 
0041 //              ---------------------
0042 //              -- Class Interface --
0043 //              ---------------------
0044 
0045 class L1MuGMTDebugBlock {
0046 public:
0047   static const int NumMatrices = 6;
0048 
0049   /// constructor
0050   L1MuGMTDebugBlock(int minbx = -10, int maxbx = 10);
0051 
0052   /// destructor
0053   virtual ~L1MuGMTDebugBlock();
0054 
0055   /// Reset the debug block
0056   void reset();
0057 
0058   /// Set the current bunch crossing
0059   void SetBX(int bx) {
0060     if (bx < _minbx || bx > _maxbx)
0061       edm::LogWarning("RangeViolation") << "L1MuGMTDebugBlock::SetBX(): bx out of range ";
0062     else
0063       _bx = bx;
0064   };
0065 
0066   // index: (0..31: 16*isFWD + 8*isISO + 4* isRPC + nr )
0067 
0068   /// Set projected phi positions for current bx
0069   void SetPhi(int idx, float phi) { _prophi[_bx - _minbx][idx] = phi; };
0070 
0071   /// Set projected eta positions for current bx
0072   void SetEta(int idx, float eta) { _proeta[_bx - _minbx][idx] = eta; };
0073 
0074   /// Set phi select bits for current bx
0075   void SetPhiSelBits(int idx, unsigned phisel) { _phisel[_bx - _minbx][idx] = phisel; };
0076 
0077   /// Set eta select bits for current bx
0078   void SetEtaSelBits(int idx, unsigned etasel) { _etasel[_bx - _minbx][idx] = etasel; };
0079 
0080   /// Set MIP/ISO bits for current bx
0081   void SetIsMIPISO(int idx, unsigned ismipiso) { _isMIPISO[_bx - _minbx][idx] = ismipiso; };
0082 
0083   /// Set pair matrices
0084   void SetPairMatrix(int idx, L1MuGMTMatrix<bool> pm) { _pairMatrices[_bx - _minbx][idx] = pm; };
0085 
0086   /// Set match quality matrices
0087   void SetMQMatrix(int idx, L1MuGMTMatrix<int> mqm) { _mqMatrices[_bx - _minbx][idx] = mqm; };
0088 
0089   /// Set cancel bits
0090   void SetCancelBits(int idx, const std::vector<bool>& mine, const std::vector<bool>& others);
0091 
0092   /// Set brl GMT Cands
0093   void SetBrlGMTCands(int idx, L1MuGMTExtendedCand const& cand) { _brlmuons[_bx - _minbx][idx] = cand; };
0094 
0095   /// Set fwd GMT Cands
0096   void SetFwdGMTCands(int idx, L1MuGMTExtendedCand const& cand) { _fwdmuons[_bx - _minbx][idx] = cand; };
0097 
0098   /// Get stored phi position
0099   float Phi(int bx, int idx) { return _prophi[bx - _minbx][idx]; };
0100 
0101   /// Get stored eta position
0102   float Eta(int bx, int idx) { return _proeta[bx - _minbx][idx]; };
0103 
0104   /// Get stored phi select bits
0105   unsigned PhiSel(int bx, int idx) { return _phisel[bx - _minbx][idx]; };
0106 
0107   /// Get stored eta select bits
0108   unsigned EtaSel(int bx, int idx) { return _etasel[bx - _minbx][idx]; };
0109 
0110   /// Get stored MIP/ISO select bits
0111   unsigned IsMIPISO(int bx, int idx) { return _isMIPISO[bx - _minbx][idx]; };
0112 
0113   /// Get pair matrices
0114   L1MuGMTMatrix<bool> GetPairMatrix(int bx, int idx) { return _pairMatrices[bx - _minbx][idx]; };
0115 
0116   /// Get match quality matrices
0117   L1MuGMTMatrix<int> GetMQMatrix(int bx, int idx) { return _mqMatrices[bx - _minbx][idx]; };
0118 
0119   /// Get Cancel Bits
0120   unsigned GetCancelBits(int bx, int idx) { return _cancelbits[bx - _minbx][idx]; };
0121 
0122   /// Get brl Cands
0123   L1MuGMTExtendedCand const& GetBrlGMTCand(int bx, int idx) { return _brlmuons[bx - _minbx][idx]; }
0124 
0125   /// Get fwd Cands
0126   L1MuGMTExtendedCand const& GetFwdGMTCand(int bx, int idx) { return _fwdmuons[bx - _minbx][idx]; }
0127 
0128   /// Get stored phi position, four indices
0129   float Phi(int bx, int isFWD, int isISO, int isRPC, int nr) {
0130     return _prophi[bx - _minbx][16 * isFWD + 8 * isISO + 4 * isRPC + nr];
0131   };
0132 
0133   /// Get stored eta position, four indices
0134   float Eta(int bx, int isFWD, int isISO, int isRPC, int nr) {
0135     return _proeta[bx - _minbx][16 * isFWD + 8 * isISO + 4 * isRPC + nr];
0136   };
0137 
0138 private:
0139   const int _minbx, _maxbx;
0140   int _bx;
0141   std::vector<std::vector<float> > _prophi;
0142   std::vector<std::vector<float> > _proeta;
0143   std::vector<std::vector<unsigned> > _phisel;
0144   std::vector<std::vector<unsigned> > _etasel;
0145   std::vector<std::vector<unsigned> > _isMIPISO;
0146 
0147   std::vector<std::vector<L1MuGMTMatrix<bool> > > _pairMatrices;
0148   std::vector<std::vector<L1MuGMTMatrix<int> > > _mqMatrices;
0149 
0150   std::vector<std::vector<unsigned> > _cancelbits;
0151   std::vector<std::vector<L1MuGMTExtendedCand> > _brlmuons;
0152   std::vector<std::vector<L1MuGMTExtendedCand> > _fwdmuons;
0153 };
0154 
0155 #endif