Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:27

0001 //-------------------------------------------------
0002 //
0003 //   Class: L1MuGMTExtendedCand
0004 //
0005 //   Description: L1 Global Muon Trigger Candidate
0006 //
0007 //
0008 //
0009 //   Author :
0010 //   H. Sakulin        HEPHY Vienna
0011 //
0012 //   Migrated to CMSSW:
0013 //   I. Mikulec
0014 //
0015 //--------------------------------------------------
0016 
0017 //-----------------------
0018 // This Class's Header --
0019 //-----------------------
0020 
0021 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTExtendedCand.h"
0022 
0023 //---------------
0024 // C++ Headers --
0025 //---------------
0026 
0027 #include <iostream>
0028 #include <iomanip>
0029 #include <cmath>
0030 
0031 //-------------------------------
0032 // Collaborating Class Headers --
0033 //-------------------------------
0034 
0035 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0036 
0037 using namespace std;
0038 
0039 //---------------------------------
0040 //       class L1MuGMTExtendedCand
0041 //---------------------------------
0042 
0043 //----------------
0044 // Constructors --
0045 //----------------
0046 
0047 L1MuGMTExtendedCand::L1MuGMTExtendedCand() : L1MuGMTCand(), m_rank(0) {}
0048 
0049 L1MuGMTExtendedCand::L1MuGMTExtendedCand(const L1MuGMTExtendedCand& mu) : L1MuGMTCand(mu), m_rank(mu.m_rank) {}
0050 
0051 L1MuGMTExtendedCand::L1MuGMTExtendedCand(unsigned data, unsigned rank, int bx) : L1MuGMTCand(data, bx), m_rank(rank) {}
0052 
0053 //--------------
0054 // Destructor --
0055 //--------------
0056 L1MuGMTExtendedCand::~L1MuGMTExtendedCand() { reset(); }
0057 
0058 //--------------
0059 // Operations --
0060 //--------------
0061 
0062 //
0063 // reset Muon Track Candidate
0064 //
0065 void L1MuGMTExtendedCand::reset() {
0066   L1MuGMTCand::reset();
0067   m_rank = 0;
0068 }
0069 
0070 //
0071 // return detector index
0072 // 1 RPC, 2 DT, 3 DT/RPC, 4 CSC, 5 CSC/RPC
0073 //
0074 // supported for backward compatibility only
0075 //
0076 
0077 unsigned int L1MuGMTExtendedCand::detector() const {
0078   if (quality() == 7)  // matched ?
0079     return isFwd() ? 5 : 3;
0080   else
0081     return isRPC() ? 1 : (isFwd() ? 4 : 2);
0082 }
0083 
0084 //
0085 // Equal operator
0086 //
0087 bool L1MuGMTExtendedCand::operator==(const L1MuGMTExtendedCand& cand) const {
0088   if ((L1MuGMTCand const&)*this != cand)
0089     return false;
0090   if (m_rank != cand.m_rank)
0091     return false;
0092   return true;
0093 }
0094 
0095 //
0096 // Unequal operator
0097 //
0098 bool L1MuGMTExtendedCand::operator!=(const L1MuGMTExtendedCand& cand) const {
0099   if ((L1MuGMTCand const&)*this != cand)
0100     return true;
0101   if (m_rank != cand.m_rank)
0102     return true;
0103   return false;
0104 }
0105 
0106 //
0107 // print parameters of track candidate
0108 //
0109 void L1MuGMTExtendedCand::print() const {
0110   L1MuGMTCand::print();
0111   if (!empty()) {
0112     edm::LogVerbatim("GMT_Candidate_info") << setiosflags(ios::right | ios::adjustfield | ios::showpoint | ios::fixed)
0113                                            << "rank = " << setw(3) << rank() << "  "
0114                                            << "idxdtcsc = " << setw(1) << getDTCSCIndex() << "  "
0115                                            << "idxrpc = " << setw(1) << getRPCIndex() << "  "
0116                                            << "isFwd = " << setw(1) << isFwd() << "  "
0117                                            << "isRPC = " << setw(1) << isRPC() << endl;
0118   }
0119 }
0120 
0121 //
0122 // output stream operator for track candidate
0123 //
0124 ostream& operator<<(ostream& s, const L1MuGMTExtendedCand& id) {
0125   if (!id.empty()) {
0126     s << ((L1MuGMTCand const&)id) << setiosflags(ios::showpoint | ios::fixed) << "rank = " << setw(3) << id.rank()
0127       << "  "
0128       << "idxdtcsc = " << setw(1) << id.getDTCSCIndex() << "  "
0129       << "idxrpc = " << setw(1) << id.getRPCIndex() << "  "
0130       << "isFwd = " << setw(1) << id.isFwd() << "  "
0131       << "isRPC = " << setw(1) << id.isRPC();
0132   }
0133   return s;
0134 }