Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:19

0001 #include "CondFormats/L1TObjects/interface/L1GctChannelMask.h"
0002 
0003 L1GctChannelMask::L1GctChannelMask() {
0004   for (unsigned i = 0; i < 18; ++i) {
0005     emCrateMask_[i] = false;
0006   }
0007   for (unsigned ieta = 0; ieta < 22; ++ieta) {
0008     for (unsigned iphi = 0; iphi < 18; ++iphi) {
0009       regionMask_[ieta][iphi] = false;
0010     }
0011   }
0012   for (unsigned i = 0; i < 22; ++i) {
0013     tetMask_[i] = false;
0014     metMask_[i] = false;
0015     htMask_[i] = false;
0016     mhtMask_[i] = false;
0017   }
0018 }
0019 
0020 void L1GctChannelMask::maskEmCrate(unsigned crate) {
0021   if (crate < 18)
0022     emCrateMask_[crate] = true;
0023 }
0024 
0025 void L1GctChannelMask::maskRegion(unsigned ieta, unsigned iphi) {
0026   if (ieta < 22 && iphi < 18)
0027     regionMask_[ieta][iphi] = true;
0028 }
0029 
0030 void L1GctChannelMask::maskTotalEt(unsigned ieta) {
0031   if (ieta < 22)
0032     tetMask_[ieta] = true;
0033 }
0034 
0035 void L1GctChannelMask::maskMissingEt(unsigned ieta) {
0036   if (ieta < 22)
0037     metMask_[ieta] = true;
0038 }
0039 
0040 void L1GctChannelMask::maskTotalHt(unsigned ieta) {
0041   if (ieta < 22)
0042     htMask_[ieta] = true;
0043 }
0044 
0045 void L1GctChannelMask::maskMissingHt(unsigned ieta) {
0046   if (ieta < 22)
0047     mhtMask_[ieta] = true;
0048 }
0049 
0050 bool L1GctChannelMask::emCrateMask(unsigned crate) const {
0051   if (crate < 18) {
0052     return emCrateMask_[crate];
0053   } else
0054     return true;
0055 }
0056 
0057 bool L1GctChannelMask::regionMask(unsigned ieta, unsigned iphi) const {
0058   if (ieta < 22 && iphi < 18) {
0059     return regionMask_[ieta][iphi];
0060   } else
0061     return true;
0062 }
0063 
0064 bool L1GctChannelMask::totalEtMask(unsigned ieta) const {
0065   if (ieta < 22)
0066     return tetMask_[ieta];
0067   else
0068     return true;
0069 }
0070 
0071 bool L1GctChannelMask::missingEtMask(unsigned ieta) const {
0072   if (ieta < 22)
0073     return metMask_[ieta];
0074   else
0075     return true;
0076 }
0077 
0078 bool L1GctChannelMask::totalHtMask(unsigned ieta) const {
0079   if (ieta < 22)
0080     return htMask_[ieta];
0081   else
0082     return true;
0083 }
0084 
0085 bool L1GctChannelMask::missingHtMask(unsigned ieta) const {
0086   if (ieta < 22)
0087     return mhtMask_[ieta];
0088   else
0089     return true;
0090 }
0091 
0092 std::ostream& operator<<(std::ostream& os, const L1GctChannelMask obj) {
0093   os << "L1GctChannelMask :" << std::endl;
0094 
0095   // get masks without changing interface, sigh
0096   unsigned emCrateMask(0), tetMask(0), metMask(0), htMask(0), mhtMask(0);
0097   for (unsigned i = 0; i < 18; ++i) {
0098     emCrateMask |= ((obj.emCrateMask(i) ? 1 : 0) << i);
0099   }
0100 
0101   for (unsigned i = 0; i < 22; ++i) {
0102     tetMask |= ((obj.totalEtMask(i) ? 1 : 0) << i);
0103     metMask |= ((obj.missingEtMask(i) ? 1 : 0) << i);
0104     htMask |= ((obj.totalHtMask(i) ? 1 : 0) << i);
0105     mhtMask |= ((obj.missingHtMask(i) ? 1 : 0) << i);
0106   }
0107 
0108   os << "  EM crate mask    = " << std::hex << emCrateMask << std::endl;
0109   os << "  EtTot mask       = " << std::hex << tetMask << std::endl;
0110   os << "  EtMiss mask      = " << std::hex << metMask << std::endl;
0111   os << "  HtTot mask       = " << std::hex << htMask << std::endl;
0112   os << "  HtMiss mask      = " << std::hex << mhtMask << std::endl;
0113 
0114   for (unsigned ieta = 0; ieta < 22; ++ieta) {
0115     for (unsigned iphi = 0; iphi < 18; ++iphi) {
0116       if (obj.regionMask(ieta, iphi)) {
0117         os << "  Region mask      : " << std::dec << ieta << ", " << iphi << std::endl;
0118       }
0119     }
0120   }
0121   return os;
0122 }