File indexing completed on 2023-10-25 09:54:47
0001 #ifndef UCTRegion_hh
0002 #define UCTRegion_hh
0003
0004 #include <vector>
0005 #include <iostream>
0006
0007 #include "UCTTower.hh"
0008
0009 namespace l1tcalo {
0010 constexpr uint32_t RegionETMask{0x000003FF};
0011 constexpr uint32_t RegionEGVeto{0x00000400};
0012 constexpr uint32_t RegionTauVeto{0x00000800};
0013 constexpr uint32_t HitTowerBits{0x0000F000};
0014 constexpr uint32_t RegionNoBits{0x000F0000};
0015 constexpr uint32_t CardNoBits{0x00700000};
0016 constexpr uint32_t CrateNoBits{0x01800000};
0017 constexpr uint32_t NegEtaBit{0x80000000};
0018 constexpr uint32_t LocationBits{0xFFFFF000};
0019 constexpr uint32_t LocationShift{12};
0020 constexpr uint32_t RegionNoShift{16};
0021 constexpr uint32_t CardNoShift{20};
0022 constexpr uint32_t CrateNoShift{23};
0023 }
0024
0025 class UCTRegion {
0026 public:
0027 UCTRegion(uint32_t crt, uint32_t crd, bool ne, uint32_t rgn, int fwv);
0028
0029
0030
0031 UCTRegion() = delete;
0032
0033
0034
0035 UCTRegion(const UCTRegion&) = delete;
0036
0037
0038
0039 const UCTRegion& operator=(const UCTRegion&) = delete;
0040
0041 virtual ~UCTRegion();
0042
0043
0044
0045 const std::vector<UCTTower*>& getTowers() { return towers; }
0046
0047
0048
0049 bool clearEvent();
0050 bool setECALData(UCTTowerIndex t, bool ecalFG, uint32_t ecalET);
0051 bool setHCALData(UCTTowerIndex t, uint32_t hcalFB, uint32_t hcalET);
0052 bool setRegionSummary(
0053 uint16_t regionData);
0054 bool process();
0055
0056
0057
0058 const uint32_t rawData() const { return regionSummary; }
0059 const uint32_t location() const { return ((regionSummary & l1tcalo::LocationBits) >> l1tcalo::LocationShift); }
0060
0061 const int hitCaloEta() const {
0062 uint32_t hitTowerLocation = (location() & 0xF);
0063 return towers[hitTowerLocation]->caloEta();
0064 }
0065
0066 const int hitCaloPhi() const {
0067 uint32_t hitTowerLocation = (location() & 0xF);
0068 return towers[hitTowerLocation]->caloPhi();
0069 }
0070
0071 const UCTTowerIndex hitTowerIndex() const { return UCTTowerIndex(hitCaloEta(), hitCaloPhi()); }
0072
0073 const UCTRegionIndex regionIndex() const {
0074 UCTGeometry g;
0075 return UCTRegionIndex(g.getUCTRegionEtaIndex(negativeEta, region), g.getUCTRegionPhiIndex(crate, card));
0076 }
0077
0078 const uint32_t compressedData() const { return regionSummary; }
0079
0080
0081
0082
0083 const uint32_t et() const { return (l1tcalo::RegionETMask & regionSummary); }
0084 const bool isEGammaLike() const { return !((l1tcalo::RegionEGVeto & regionSummary) == l1tcalo::RegionEGVeto); }
0085 const bool isTauLike() const { return !((l1tcalo::RegionTauVeto & regionSummary) == l1tcalo::RegionTauVeto); }
0086
0087
0088
0089 const uint32_t getCrate() const { return crate; }
0090 const uint32_t getCard() const { return card; }
0091 const uint32_t getRegion() const { return region; }
0092
0093 const bool isNegativeEta() const { return negativeEta; }
0094
0095 const UCTTower* getTower(UCTTowerIndex t) const { return getTower(t.first, t.second); }
0096
0097 friend std::ostream& operator<<(std::ostream&, const UCTRegion&);
0098
0099 protected:
0100
0101
0102 const UCTTower* getTower(uint32_t caloEta, uint32_t caloPhi) const;
0103
0104
0105
0106 uint32_t crate;
0107 uint32_t card;
0108 uint32_t region;
0109 bool negativeEta;
0110
0111
0112
0113 std::vector<UCTTower*> towers;
0114
0115 uint32_t regionSummary;
0116
0117 const int fwVersion;
0118 };
0119
0120 #endif