Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:30

0001 
0002 #include "DataFormats/L1TCalorimeter/interface/CaloCluster.h"
0003 
0004 l1t::CaloCluster::CaloCluster(const LorentzVector p4, int pt, int eta, int phi)
0005     : L1Candidate(p4, pt, eta, phi),
0006       m_clusterFlags(0x7FF)  // first 11 flags at 1
0007 {}
0008 
0009 l1t::CaloCluster::~CaloCluster() {}
0010 
0011 void l1t::CaloCluster::setClusterFlag(ClusterFlag flag, bool val) {
0012   if (val) {
0013     m_clusterFlags |= (0x1 << flag);
0014   } else {
0015     m_clusterFlags &= ~(0x1 << flag);
0016   }
0017 };
0018 
0019 void l1t::CaloCluster::setHwPtEm(int pt) { m_hwPtEm = pt; }
0020 
0021 void l1t::CaloCluster::setHwPtHad(int pt) { m_hwPtHad = pt; }
0022 
0023 void l1t::CaloCluster::setHwSeedPt(int pt) { m_hwSeedPt = pt; }
0024 
0025 void l1t::CaloCluster::setFgEta(int fgEta) { m_fgEta = fgEta; }
0026 
0027 void l1t::CaloCluster::setFgPhi(int fgPhi) { m_fgPhi = fgPhi; }
0028 
0029 void l1t::CaloCluster::setHOverE(int hOverE) { m_hOverE = hOverE; }
0030 
0031 void l1t::CaloCluster::setFgECAL(int fgECAL) { m_fgECAL = fgECAL; }
0032 
0033 bool l1t::CaloCluster::checkClusterFlag(ClusterFlag flag) const { return (m_clusterFlags & (0x1 << flag)); };
0034 
0035 bool l1t::CaloCluster::isValid() const { return (checkClusterFlag(INCLUDE_SEED)); }
0036 
0037 int l1t::CaloCluster::hwPtEm() const { return m_hwPtEm; }
0038 
0039 int l1t::CaloCluster::hwPtHad() const { return m_hwPtHad; }
0040 
0041 int l1t::CaloCluster::hwSeedPt() const { return m_hwSeedPt; }
0042 
0043 int l1t::CaloCluster::fgEta() const { return m_fgEta; }
0044 
0045 int l1t::CaloCluster::fgPhi() const { return m_fgPhi; }
0046 
0047 int l1t::CaloCluster::hOverE() const { return m_hOverE; }
0048 
0049 int l1t::CaloCluster::fgECAL() const { return m_fgECAL; }
0050 
0051 bool l1t::CaloCluster::operator<(const CaloCluster& cl) const {
0052   bool res = false;
0053   // Favour high pT
0054   if (hwPt() < cl.hwPt())
0055     res = true;
0056   else if (hwPt() == cl.hwPt()) {
0057     // Favour central clusters
0058     if (abs(hwEta()) > abs(cl.hwEta()))
0059       res = true;
0060     else if (abs(hwEta()) == abs(cl.hwEta())) {
0061       // Favour small phi (arbitrary)
0062       if (hwPhi() > cl.hwPhi())
0063         res = true;
0064     }
0065   }
0066   return res;
0067 }