CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/DataFormats/L1GlobalMuonTrigger/src/L1MuGMTCand.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: L1MuGMTCand
00004 //
00005 //   Description: L1 Global Muon Trigger Candidate
00006 //
00007 //
00008 //   $Date: 2007/09/06 13:48:48 $
00009 //   $Revision: 1.6 $
00010 //
00011 //   Author :
00012 //   N. Neumeister            CERN EP 
00013 //
00014 //   Migrated to CMSSW:
00015 //   I. Mikulec
00016 //
00017 //--------------------------------------------------
00018 
00019 //-----------------------
00020 // This Class's Header --
00021 //-----------------------
00022 
00023 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCand.h"
00024 
00025 //---------------
00026 // C++ Headers --
00027 //---------------
00028 
00029 #include <iostream>
00030 #include <iomanip>
00031 #include <cmath>
00032 
00033 //-------------------------------
00034 // Collaborating Class Headers --
00035 //-------------------------------
00036 
00037 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00038 
00039 //---------------------------------
00040 //       class L1MuGMTCand
00041 //---------------------------------
00042 
00043 using namespace std;
00044 
00045 const float L1MuGMTCand::m_invalidValue = -10.;
00046 
00047 //----------------
00048 // Constructors --
00049 //----------------
00050 
00051 L1MuGMTCand::L1MuGMTCand() : m_name("L1MuGMTCand"), m_bx(0), m_dataWord(0) {
00052   m_phiValue = m_invalidValue; 
00053   m_etaValue = m_invalidValue;
00054   m_ptValue = m_invalidValue;
00055 }
00056 
00057 
00058 L1MuGMTCand::L1MuGMTCand(const L1MuGMTCand& mu) :
00059   m_name(mu.m_name), m_bx(mu.m_bx), m_dataWord(mu.m_dataWord),
00060   m_phiValue(mu.m_phiValue), m_etaValue(mu.m_etaValue), m_ptValue(mu.m_ptValue) {
00061 }
00062 
00063 L1MuGMTCand::L1MuGMTCand(unsigned data, int bx) : 
00064   m_name("L1MuGMTCand"), m_bx(bx) , m_dataWord(data) {
00065 
00066   m_phiValue = m_invalidValue; 
00067   m_etaValue = m_invalidValue;
00068   m_ptValue = m_invalidValue;
00069 
00070 }
00071 
00072 //--------------
00073 // Destructor --
00074 //--------------
00075 L1MuGMTCand::~L1MuGMTCand() {
00076 
00077   reset();
00078 
00079 }
00080 
00081 
00082 //--------------
00083 // Operations --
00084 //--------------
00085 
00086 //
00087 // reset Muon Track Candidate
00088 //
00089 void L1MuGMTCand::reset() {
00090 
00091   m_bx       = 0;
00092   m_dataWord = 0;
00093   m_phiValue = m_invalidValue; 
00094   m_etaValue = m_invalidValue;
00095   m_ptValue = m_invalidValue;
00096 
00097 }
00098 
00099 //
00100 // return phi of track candidate in radians
00101 //
00102 float L1MuGMTCand::phiValue() const {
00103 
00104   if(m_phiValue == m_invalidValue) {
00105     edm::LogWarning("ValueInvalid") << 
00106      "L1MuGMTCand::phiValue requested physical value is invalid";
00107   }
00108   return m_phiValue;
00109 
00110 }
00111 
00112 
00113 //
00114 // return eta of track candidate
00115 //
00116 float L1MuGMTCand::etaValue() const {
00117 
00118   if(m_etaValue == m_invalidValue) {
00119     edm::LogWarning("ValueInvalid") << 
00120      "L1MuGMTCand::etaValue requested physical value is invalid";
00121   }
00122   return m_etaValue;
00123 
00124 }
00125 
00126 
00127 //
00128 // return pt-value of track candidate in GeV
00129 //
00130 float L1MuGMTCand::ptValue() const {
00131 
00132   if(m_ptValue == m_invalidValue) {
00133     edm::LogWarning("ValueInvalid") << 
00134      "L1MuRegionalCand::ptValue requested physical value is invalid";
00135   }
00136   return m_ptValue;
00137 
00138 }
00139 
00140 //
00141 // Equal operator
00142 //
00143 bool L1MuGMTCand::operator==(const L1MuGMTCand& cand) const {
00144 
00145   if ( m_bx        != cand.m_bx )        return false; 
00146   if ( m_dataWord  != cand.m_dataWord )  return false;
00147   return true;
00148 
00149 }
00150 
00151 
00152 //
00153 // Unequal operator
00154 //
00155 bool L1MuGMTCand::operator!=(const L1MuGMTCand& cand) const {
00156 
00157   if ( m_bx        != cand.m_bx )        return true;  
00158   if ( m_dataWord  != cand.m_dataWord )  return true;
00159   return false;
00160 
00161 }
00162 
00163 
00164 //
00165 // print parameters of track candidate
00166 //
00167 void L1MuGMTCand::print() const {
00168 
00169   if ( !empty() ) {
00170     if(m_phiValue == m_invalidValue ||
00171        m_etaValue == m_invalidValue ||
00172        m_ptValue == m_invalidValue) {
00173       edm::LogVerbatim("GMT_Candidate_info")
00174            << setiosflags(ios::right | ios::adjustfield | ios::showpoint | ios::fixed)
00175            << "bx = " << setw(2) << bx() << " " << endl
00176            << "pt(index) = "  << setw(2) << ptIndex() << "  "
00177            << "charge = " << setw(2) << charge() << "  "
00178            << "eta(index) = " << setw(2) << etaIndex() << "  "
00179            << "phi(index) = " << setw(3) << phiIndex() << "  "
00180            << "quality = " << setw(1) << quality() << "  "
00181            << "isolated = " << setw(1) << isol() << "  "
00182            << "mip = " << setw(1) << mip() << endl;
00183     } else {
00184       edm::LogVerbatim("GMT_Candidate_info")
00185            << setiosflags(ios::right | ios::adjustfield | ios::showpoint | ios::fixed)
00186            << "bx = " << setw(2) << bx() << " " << endl
00187            << "pt = "  << setw(5) << setprecision(1) << ptValue() << " GeV  "
00188            << "charge = " << setw(2) << charge() << "  "
00189            << "eta = " << setw(5) << setprecision(2) << etaValue() << "  "
00190            << "phi = " << setw(5) << setprecision(3) << phiValue() << " rad  "
00191            << "quality = " << setw(1) << quality() << "  "
00192            << "isolated = " << setw(1) << isol() << "  "
00193            << "mip = " << setw(1) << mip() << endl;
00194     }
00195   }
00196 
00197 }
00198 
00199 
00200 //
00201 // output stream operator for track candidate
00202 //
00203 ostream& operator<<(ostream& s, const L1MuGMTCand& id) {
00204 
00205   if ( !id.empty() ) {
00206     s << setiosflags(ios::showpoint | ios::fixed) 
00207       << "bx = " << setw(2) << id.bx() << "  "
00208       << "pt = "  << setw(5) << setprecision(1) << id.ptValue() << " GeV  "
00209       << "charge = " << setw(2) << id.charge() << "  " 
00210       << "eta = " << setw(5) << setprecision(2) << id.etaValue() << "  " 
00211       << "phi = " << setw(5) << setprecision(3) << id.phiValue() << " rad  "
00212       << "quality = " << setw(1) << id.quality() << "  "
00213       << "isolated = " << setw(1) << id.isol() << "  "
00214       << "mip = " << setw(1) << id.mip() << "  ";
00215   }
00216   return s;
00217 
00218 }
00219 
00220 
00221 
00222 
00223 
00224 
00225 
00226