Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-02 03:45:48

0001 //-------------------------------------------------
0002 //
0003 //   Class: L1MuDTSecProcId
0004 //
0005 //   Description: Sector Processor identifier
0006 //
0007 //
0008 //
0009 //   Author :
0010 //   N. Neumeister             CERN EP
0011 //
0012 //--------------------------------------------------
0013 
0014 //-----------------------
0015 // This Class's Header --
0016 //-----------------------
0017 
0018 #include "L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h"
0019 
0020 //---------------
0021 // C++ Headers --
0022 //---------------
0023 
0024 #include <iostream>
0025 #include <iomanip>
0026 #include <cstdlib>
0027 
0028 //-------------------------------
0029 // Collaborating Class Headers --
0030 //-------------------------------
0031 
0032 using namespace std;
0033 
0034 // --------------------------------
0035 //       class L1MuDTSecProcId
0036 //---------------------------------
0037 
0038 //----------------
0039 // Constructors --
0040 //----------------
0041 
0042 L1MuDTSecProcId::L1MuDTSecProcId() : m_wheel(0), m_sector(0) {}
0043 
0044 L1MuDTSecProcId::L1MuDTSecProcId(int wheel_id, int sector_id) : m_wheel(wheel_id), m_sector(sector_id) {
0045   if (!(wheel_id >= -3 && wheel_id <= 3)) {
0046     //    cerr << "SecProcId : wheel out of range: " << wheel_id << endl;
0047   }
0048   if (!(sector_id >= 0 && sector_id < 12)) {
0049     //    cerr << "SecProcId : sector out of range: " << sector_id << endl;
0050   }
0051 }
0052 
0053 L1MuDTSecProcId::L1MuDTSecProcId(const L1MuDTSecProcId& id) : m_wheel(id.m_wheel), m_sector(id.m_sector) {}
0054 
0055 //--------------
0056 // Destructor --
0057 //--------------
0058 
0059 L1MuDTSecProcId::~L1MuDTSecProcId() {}
0060 
0061 //--------------
0062 // Operations --
0063 //--------------
0064 
0065 //
0066 // Assignment operator
0067 //
0068 L1MuDTSecProcId& L1MuDTSecProcId::operator=(const L1MuDTSecProcId& id) {
0069   if (this != &id) {
0070     m_wheel = id.m_wheel;
0071     m_sector = id.m_sector;
0072   }
0073   return *this;
0074 }
0075 
0076 //
0077 // return logical wheel
0078 //
0079 int L1MuDTSecProcId::locwheel() const { return (m_wheel / abs(m_wheel) * (abs(m_wheel) - 1)); }
0080 
0081 //
0082 // Equal operator
0083 //
0084 bool L1MuDTSecProcId::operator==(const L1MuDTSecProcId& id) const {
0085   if (wheel() != id.wheel())
0086     return false;
0087   if (sector() != id.sector())
0088     return false;
0089   return true;
0090 }
0091 
0092 //
0093 // Unequal operator
0094 //
0095 bool L1MuDTSecProcId::operator!=(const L1MuDTSecProcId& id) const {
0096   if (m_wheel != id.wheel())
0097     return true;
0098   if (m_sector != id.sector())
0099     return true;
0100   return false;
0101 }
0102 
0103 //
0104 // Less operator
0105 //
0106 bool L1MuDTSecProcId::operator<(const L1MuDTSecProcId& id) const {
0107   if (sector() < id.sector())
0108     return true;
0109   if (sector() > id.sector())
0110     return false;
0111   if (wheel() < 0 && id.wheel() < 0) {
0112     if (-wheel() < -id.wheel())
0113       return true;
0114   } else {
0115     if (wheel() < id.wheel())
0116       return true;
0117   }
0118   return false;
0119 }
0120 
0121 //
0122 // output stream operator
0123 //
0124 ostream& operator<<(ostream& s, const L1MuDTSecProcId& id) {
0125   s.setf(ios::right, ios::adjustfield);
0126   s << "Sector Processor ( " << setw(2) << id.wheel() << "," << setw(2) << id.sector() << " )";
0127   return s;
0128 }