CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: L1MuDTTrackSegLoc
00004 //
00005 //   Description: Logical location of a Track Segment
00006 //
00007 //
00008 //   $Date: 2008/10/13 07:44:43 $
00009 //   $Revision: 1.3 $
00010 //
00011 //   Author :
00012 //   N. Neumeister             CERN EP
00013 //
00014 //--------------------------------------------------
00015 
00016 //-----------------------
00017 // This Class's Header --
00018 //-----------------------
00019 
00020 #include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.h"
00021 
00022 //---------------
00023 // C++ Headers --
00024 //---------------
00025 
00026 #include <iostream>
00027 #include <iomanip>
00028 #include <cstdlib>
00029 #include <cassert>
00030 
00031 //-------------------------------
00032 // Collaborating Class Headers --
00033 //-------------------------------
00034 
00035 using namespace std;
00036 
00037 // --------------------------------
00038 //       class L1MuDTTrackSegLoc   
00039 //---------------------------------
00040 
00041 //----------------
00042 // Constructors --
00043 //----------------
00044 
00045 L1MuDTTrackSegLoc::L1MuDTTrackSegLoc() :
00046   m_wheel(0), m_sector(0), m_station(0) {}
00047 
00048 L1MuDTTrackSegLoc::L1MuDTTrackSegLoc(int wheel_id, 
00049                                      int sector_id,
00050                                      int station_id) : 
00051   m_wheel(wheel_id), m_sector(sector_id), m_station(station_id) { 
00052   
00053   //  assert(wheel_id   >= -3 && wheel_id   <=  3);
00054   //  assert(sector_id  >=  0 && sector_id  <  12);
00055 
00056   if ( abs(wheel_id) == 3 ) { 
00057     //    assert(station_id >= 3 && station_id <= 4);
00058   }
00059   else {
00060     //    assert(station_id >= 1 && station_id <= 4);
00061   }
00062 
00063 }                                                
00064 
00065 
00066 L1MuDTTrackSegLoc::L1MuDTTrackSegLoc(const L1MuDTTrackSegLoc &id) :
00067   m_wheel(id.m_wheel), m_sector(id.m_sector), m_station(id.m_station) {}
00068 
00069 
00070 //--------------
00071 // Destructor --
00072 //--------------
00073 
00074 L1MuDTTrackSegLoc::~L1MuDTTrackSegLoc() {}
00075 
00076 
00077 //--------------
00078 // Operations --
00079 //--------------
00080 
00081 //
00082 // Assignment operator
00083 //
00084 L1MuDTTrackSegLoc& L1MuDTTrackSegLoc::operator=(const L1MuDTTrackSegLoc& id) {
00085 
00086   if ( this != &id ) {
00087     m_wheel   = id.m_wheel;
00088     m_sector  = id.m_sector;
00089     m_station = id.m_station; 
00090   }
00091   return *this; 
00092   
00093 }
00094 
00095 
00096 //
00097 // Equal operator
00098 //
00099 bool L1MuDTTrackSegLoc::operator==(const L1MuDTTrackSegLoc& id) const { 
00100 
00101   if ( m_wheel   != id.wheel() )   return false;
00102   if ( m_sector  != id.sector() )  return false;
00103   if ( m_station != id.station() ) return false;
00104   return true;
00105   
00106 }
00107 
00108 
00109 //
00110 // Unequal operator
00111 //
00112 bool L1MuDTTrackSegLoc::operator!=(const L1MuDTTrackSegLoc& id) const {
00113 
00114   if ( m_wheel   != id.wheel() )   return true;
00115   if ( m_sector  != id.sector() )  return true;
00116   if ( m_station != id.station() ) return true;
00117   return false;
00118   
00119 }
00120 
00121 
00122 //
00123 // Less operator
00124 //
00125 bool L1MuDTTrackSegLoc::operator<(const L1MuDTTrackSegLoc& id) const { 
00126 
00127   if ( wheel()   < id.wheel()   ) return true;
00128   if ( wheel()   > id.wheel()   ) return false;
00129   if ( sector()  < id.sector()  ) return true;
00130   if ( sector()  > id.sector()  ) return false;
00131   if ( station() < id.station() ) return true;
00132   if ( station() > id.station() ) return false;
00133   return false;
00134   
00135 }
00136 
00137 
00138 //
00139 // output stream operator
00140 //
00141 ostream& operator<<(ostream& s, const L1MuDTTrackSegLoc& id) {
00142 
00143   s.setf(ios::right,ios::adjustfield);
00144   s << "wheel = "   << setw(2) << id.wheel()   << "  " 
00145     << "sector = "  << setw(2) << id.sector()  << "  " 
00146     << "station = " << setw(1) << id.station();
00147 
00148   return s;
00149              
00150 }