00001 #include "CondFormats/L1TObjects/interface/L1GctChannelMask.h" 00002 00003 L1GctChannelMask::L1GctChannelMask() { 00004 for (unsigned i=0; i<18; ++i) { 00005 emCrateMask_[i] = false; 00006 } 00007 for (unsigned ieta=0; ieta<22; ++ieta) { 00008 for (unsigned iphi=0; iphi<18; ++iphi) { 00009 regionMask_[ieta][iphi] = false; 00010 } 00011 } 00012 for (unsigned i=0; i<22; ++i) { 00013 tetMask_[i] = false; 00014 metMask_[i] = false; 00015 htMask_[i] = false; 00016 mhtMask_[i] = false; 00017 } 00018 } 00019 00020 00021 void L1GctChannelMask::maskEmCrate(unsigned crate) { 00022 if (crate < 18) emCrateMask_[crate] = true; 00023 } 00024 00025 00026 void L1GctChannelMask::maskRegion(unsigned ieta, unsigned iphi) { 00027 if (ieta < 22 && iphi < 18) regionMask_[ieta][iphi] = true; 00028 } 00029 00030 00031 void L1GctChannelMask::maskTotalEt(unsigned ieta) { 00032 if (ieta < 22) tetMask_[ieta] = true; 00033 } 00034 00035 00036 void L1GctChannelMask::maskMissingEt(unsigned ieta) { 00037 if (ieta < 22) metMask_[ieta] = true; 00038 } 00039 00040 00041 void L1GctChannelMask::maskTotalHt(unsigned ieta) { 00042 if (ieta < 22) htMask_[ieta] = true; 00043 } 00044 00045 00046 void L1GctChannelMask::maskMissingHt(unsigned ieta) { 00047 if (ieta < 22) mhtMask_[ieta] = true; 00048 } 00049 00050 00051 bool L1GctChannelMask::emCrateMask(unsigned crate) const { 00052 if (crate < 18) { return emCrateMask_[crate]; } 00053 else return true; 00054 } 00055 00056 00057 bool L1GctChannelMask::regionMask(unsigned ieta, unsigned iphi) const { 00058 if (ieta < 22 && iphi < 18) { return regionMask_[ieta][iphi]; } 00059 else return true; 00060 } 00061 00062 00063 bool L1GctChannelMask::totalEtMask(unsigned ieta) const { 00064 if (ieta < 22) return tetMask_[ieta]; 00065 else return true; 00066 } 00067 00068 00069 bool L1GctChannelMask::missingEtMask(unsigned ieta) const { 00070 if (ieta < 22) return metMask_[ieta]; 00071 else return true; 00072 } 00073 00074 00075 bool L1GctChannelMask::totalHtMask(unsigned ieta) const { 00076 if (ieta < 22) return htMask_[ieta]; 00077 else return true; 00078 } 00079 00080 00081 bool L1GctChannelMask::missingHtMask(unsigned ieta) const { 00082 if (ieta < 22) return mhtMask_[ieta]; 00083 else return true; 00084 } 00085 00086 std::ostream& operator << (std::ostream& os, const L1GctChannelMask obj) { 00087 os << "L1GctChannelMask :" << std::endl; 00088 00089 // get masks without changing interface, sigh 00090 unsigned emCrateMask(0), tetMask(0), metMask(0), htMask(0), mhtMask(0); 00091 for (unsigned i=0; i<18; ++i) { 00092 emCrateMask |= ((obj.emCrateMask(i)?1:0)<<i); 00093 } 00094 00095 for (unsigned i=0; i<22; ++i) { 00096 tetMask |= ((obj.totalEtMask(i)?1:0)<<i); 00097 metMask |= ((obj.missingEtMask(i)?1:0)<<i); 00098 htMask |= ((obj.totalHtMask(i)?1:0)<<i); 00099 mhtMask |= ((obj.missingHtMask(i)?1:0)<<i); 00100 } 00101 00102 os << " EM crate mask = " << std::hex << emCrateMask << std::endl; 00103 os << " EtTot mask = " << std::hex << tetMask << std::endl; 00104 os << " EtMiss mask = " << std::hex << metMask << std::endl; 00105 os << " HtTot mask = " << std::hex << htMask << std::endl; 00106 os << " HtMiss mask = " << std::hex << mhtMask << std::endl; 00107 00108 for (unsigned ieta=0; ieta<22; ++ieta) { 00109 for (unsigned iphi=0; iphi<18; ++iphi) { 00110 if ( obj.regionMask(ieta, iphi) ) { 00111 os << " Region mask : " << std::dec << ieta << ", " << iphi << std::endl; 00112 } 00113 } 00114 } 00115 return os; 00116 }