File indexing completed on 2024-04-06 12:04:25
0001 #ifndef L1CALOEMCAND_H
0002 #define L1CALOEMCAND_H
0003
0004 #include <ostream>
0005
0006 #include "DataFormats/L1CaloTrigger/interface/L1CaloRegionDetId.h"
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 class L1CaloEmCand {
0018 public:
0019
0020 L1CaloEmCand();
0021
0022
0023 L1CaloEmCand(uint16_t data, unsigned crate, bool iso);
0024
0025
0026
0027 L1CaloEmCand(uint16_t data, unsigned crate, bool iso, uint16_t index, int16_t bx, bool dummy);
0028
0029
0030 L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso);
0031
0032
0033 L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx);
0034
0035
0036 ~L1CaloEmCand();
0037
0038
0039 uint16_t raw() const { return m_data; }
0040
0041
0042 unsigned rank() const { return m_data & 0x3f; }
0043
0044
0045 unsigned rctCard() const { return (m_data >> 7) & 0x7; }
0046
0047
0048 unsigned rctRegion() const { return (m_data >> 6) & 0x1; }
0049
0050
0051 unsigned rctCrate() const { return m_rctCrate; }
0052
0053
0054 bool isolated() const { return m_iso; }
0055
0056
0057 unsigned index() const { return m_index; }
0058
0059
0060 int16_t bx() const { return m_bx; }
0061
0062
0063 L1CaloRegionDetId regionId() const { return L1CaloRegionDetId(rctCrate(), rctCard(), rctRegion()); }
0064
0065
0066 void setBx(int16_t bx);
0067
0068
0069 int operator==(const L1CaloEmCand& c) const {
0070 return ((m_data == c.raw() && m_iso == c.isolated() && m_rctCrate == c.rctCrate() &&
0071 this->regionId() == c.regionId()) ||
0072 (this->empty() && c.empty()));
0073 }
0074
0075
0076 int operator!=(const L1CaloEmCand& c) const { return !(*this == c); }
0077
0078
0079 bool empty() const { return (rank() == 0); }
0080
0081 private:
0082
0083 uint16_t m_data;
0084
0085
0086
0087 uint16_t m_rctCrate;
0088 bool m_iso;
0089 uint16_t m_index;
0090 int16_t m_bx;
0091 };
0092
0093 std::ostream& operator<<(std::ostream& s, const L1CaloEmCand& cand);
0094
0095 #endif