File indexing completed on 2024-04-06 12:21:37
0001 #include "L1Trigger/RegionalCaloTrigger/interface/L1RCTRegion.h"
0002
0003 #include <vector>
0004 using std::vector;
0005
0006 #include <iostream>
0007 using std::cerr;
0008 using std::cout;
0009 using std::endl;
0010
0011 L1RCTRegion::L1RCTRegion() : totalRegionEt(36), totalRegionHE_FG(36), etIn9Bits(16), muonBit(16), activityBit(16) {}
0012
0013 L1RCTRegion::~L1RCTRegion() {}
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 unsigned short L1RCTRegion::getEtIn7Bits(int i, int j) const {
0026
0027 return totalRegionEt.at(6 * (i + 1) + j + 1);
0028 }
0029
0030 void L1RCTRegion::setEtIn7Bits(int i, int j, unsigned short energy) {
0031
0032 if (energy <= 127)
0033 totalRegionEt.at(6 * (i + 1) + j + 1) = energy;
0034 else
0035 totalRegionEt.at(6 * (i + 1) + j + 1) = 127;
0036 }
0037
0038 unsigned short L1RCTRegion::getHE_FGBit(int i, int j) const { return totalRegionHE_FG.at(6 * (i + 1) + j + 1); }
0039
0040 void L1RCTRegion::setHE_FGBit(int i, int j, unsigned short HE_FG) { totalRegionHE_FG.at(6 * (i + 1) + j + 1) = HE_FG; }
0041
0042
0043
0044
0045 unsigned short L1RCTRegion::getEtIn9Bits(int i, int j) const { return etIn9Bits.at(4 * i + j); }
0046
0047 void L1RCTRegion::setEtIn9Bits(int i, int j, unsigned short energy) {
0048 if (energy <= 511)
0049 etIn9Bits.at(4 * i + j) = energy;
0050 else
0051 etIn9Bits.at(4 * i + j) = 511;
0052 }
0053
0054 unsigned short L1RCTRegion::getMuonBit(int i, int j) const { return muonBit.at(4 * i + j); }
0055
0056 void L1RCTRegion::setMuonBit(int i, int j, unsigned short muon) { muonBit.at(4 * i + j) = muon; }
0057
0058 void L1RCTRegion::setActivityBit(int i, int j, unsigned short activity) { activityBit.at(4 * i + j) = activity; }
0059
0060 unsigned short L1RCTRegion::getActivityBit(int i, int j) const { return activityBit.at(4 * i + j); }
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073 vector<unsigned short> L1RCTRegion::giveNorthEt() const {
0074 std::vector<unsigned short> north(4);
0075 for (int i = 0; i < 4; i++)
0076 north.at(i) = getEtIn7Bits(3, i);
0077 return north;
0078 }
0079 void L1RCTRegion::setNorthEt(const std::vector<unsigned short> &north) {
0080 for (int i = 0; i < 4; i++)
0081 totalRegionEt.at(i + 1) = north.at(i);
0082 }
0083 vector<unsigned short> L1RCTRegion::giveNorthHE_FG() const {
0084 std::vector<unsigned short> north(4);
0085 for (int i = 0; i < 4; i++)
0086 north.at(i) = getHE_FGBit(3, i);
0087 return north;
0088 }
0089 void L1RCTRegion::setNorthHE_FG(const std::vector<unsigned short> &north) {
0090 for (int i = 0; i < 4; i++)
0091 totalRegionHE_FG.at(i + 1) = north.at(i);
0092 }
0093
0094 vector<unsigned short> L1RCTRegion::giveSouthEt() const {
0095 std::vector<unsigned short> south(4);
0096 for (int i = 0; i < 4; i++)
0097 south.at(i) = getEtIn7Bits(0, i);
0098 return south;
0099 }
0100 void L1RCTRegion::setSouthEt(const std::vector<unsigned short> &south) {
0101 for (int i = 0; i < 4; i++)
0102 totalRegionEt.at(31 + i) = south.at(i);
0103 }
0104
0105 vector<unsigned short> L1RCTRegion::giveSouthHE_FG() const {
0106 std::vector<unsigned short> south(4);
0107 for (int i = 0; i < 4; i++)
0108 south.at(i) = getHE_FGBit(0, i);
0109 return south;
0110 }
0111 void L1RCTRegion::setSouthHE_FG(const std::vector<unsigned short> &south) {
0112 for (int i = 0; i < 4; i++)
0113 totalRegionHE_FG.at(31 + i) = south.at(i);
0114 }
0115
0116 vector<unsigned short> L1RCTRegion::giveWestEt() const {
0117 std::vector<unsigned short> west(4);
0118 for (int i = 0; i < 4; i++)
0119 west.at(i) = getEtIn7Bits(i, 3);
0120 return west;
0121 }
0122 void L1RCTRegion::setWestEt(const std::vector<unsigned short> &west) {
0123 for (int i = 0; i < 4; i++)
0124 totalRegionEt.at(6 * (i + 1)) = west.at(i);
0125 }
0126
0127 vector<unsigned short> L1RCTRegion::giveWestHE_FG() const {
0128 std::vector<unsigned short> west(4);
0129 for (int i = 0; i < 4; i++)
0130 west.at(i) = getHE_FGBit(i, 3);
0131 return west;
0132 }
0133 void L1RCTRegion::setWestHE_FG(const std::vector<unsigned short> &west) {
0134 for (int i = 0; i < 4; i++)
0135 totalRegionHE_FG.at(6 * (i + 1)) = west.at(i);
0136 }
0137
0138 vector<unsigned short> L1RCTRegion::giveEastEt() const {
0139 std::vector<unsigned short> east(4);
0140 for (int i = 0; i < 4; i++)
0141 east.at(i) = getEtIn7Bits(i, 0);
0142 return east;
0143 }
0144 void L1RCTRegion::setEastEt(const std::vector<unsigned short> &east) {
0145 for (int i = 0; i < 4; i++)
0146 totalRegionEt.at(6 * (i + 1) + 5) = east.at(i);
0147 }
0148
0149 vector<unsigned short> L1RCTRegion::giveEastHE_FG() const {
0150 std::vector<unsigned short> east(4);
0151 for (int i = 0; i < 4; i++)
0152 east.at(i) = getHE_FGBit(i, 0);
0153 return east;
0154 }
0155 void L1RCTRegion::setEastHE_FG(const std::vector<unsigned short> &east) {
0156 for (int i = 0; i < 4; i++)
0157 totalRegionHE_FG.at(6 * (i + 1) + 5) = east.at(i);
0158 }
0159
0160 unsigned short L1RCTRegion::giveNEEt() const {
0161 unsigned short et = getEtIn7Bits(3, 0);
0162 if (et > 7)
0163 return 7;
0164 else
0165 return et;
0166 }
0167 unsigned short L1RCTRegion::giveNEHE_FG() const { return getHE_FGBit(3, 0); }
0168 void L1RCTRegion::setNEEt(unsigned short ne) { totalRegionEt.at(5) = ne; }
0169 void L1RCTRegion::setNEHE_FG(unsigned short ne) { totalRegionHE_FG.at(5) = ne; }
0170
0171 unsigned short L1RCTRegion::giveNWEt() const {
0172 unsigned short et = getEtIn7Bits(3, 3);
0173 if (et > 7)
0174 return 7;
0175 else
0176 return et;
0177 }
0178 unsigned short L1RCTRegion::giveNWHE_FG() const { return getHE_FGBit(3, 3); }
0179 void L1RCTRegion::setNWEt(unsigned short nw) { totalRegionEt.at(0) = nw; }
0180 void L1RCTRegion::setNWHE_FG(unsigned short nw) { totalRegionHE_FG.at(0) = nw; }
0181
0182 unsigned short L1RCTRegion::giveSWEt() const {
0183 unsigned short et = getEtIn7Bits(0, 3);
0184 if (et > 7)
0185 return 7;
0186 else
0187 return et;
0188 }
0189 unsigned short L1RCTRegion::giveSWHE_FG() const { return getHE_FGBit(0, 3); }
0190 void L1RCTRegion::setSWEt(unsigned short sw) { totalRegionEt.at(30) = sw; }
0191 void L1RCTRegion::setSWHE_FG(unsigned short sw) { totalRegionHE_FG.at(30) = sw; }
0192
0193 unsigned short L1RCTRegion::giveSEEt() const {
0194 unsigned short et = getEtIn7Bits(0, 0);
0195 if (et > 7)
0196 return 7;
0197 else
0198 return et;
0199 }
0200 unsigned short L1RCTRegion::giveSEHE_FG() const { return getHE_FGBit(0, 0); }
0201 void L1RCTRegion::setSEEt(unsigned short se) { totalRegionEt.at(35) = se; }
0202 void L1RCTRegion::setSEHE_FG(unsigned short se) { totalRegionHE_FG.at(35) = se; }
0203
0204 void L1RCTRegion::print() {
0205 std::cout << " 7 Bit Energies ";
0206 for (int i = 0; i < 4; i++) {
0207 std::cout << std::endl;
0208 for (int j = 0; j < 4; j++) {
0209 std::cout << " " << getEtIn7Bits(i, j) << " ";
0210 }
0211 }
0212
0213 std::cout << std::endl << std::endl;
0214 std::cout << " 9 Bit Energies ";
0215 for (int i = 0; i < 4; i++) {
0216 std::cout << std::endl;
0217 for (int j = 0; j < 4; j++) {
0218 std::cout << " " << getEtIn9Bits(i, j) << " ";
0219 }
0220 }
0221
0222 std::cout << std::endl << std::endl;
0223 std::cout << " HE || FG bit ";
0224 for (int i = 0; i < 4; i++) {
0225 std::cout << std::endl;
0226 for (int j = 0; j < 4; j++) {
0227 std::cout << " " << getHE_FGBit(i, j) << " ";
0228 }
0229 }
0230
0231 std::cout << std::endl << std::endl;
0232 std::cout << " Muon Bit ";
0233 for (int i = 0; i < 4; i++) {
0234 std::cout << std::endl;
0235 for (int j = 0; j < 4; j++) {
0236 std::cout << " " << getMuonBit(i, j) << " ";
0237 }
0238 }
0239 std::cout << std::endl;
0240 }
0241
0242 void L1RCTRegion::printEdges() {
0243 std::cout << "North" << std::endl;
0244 for (int i = 0; i < 4; i++)
0245 std::cout << totalRegionEt.at(i + 1) << std::endl;
0246
0247 std::cout << "West" << std::endl;
0248 for (int i = 0; i < 4; i++)
0249 std::cout << totalRegionEt.at(6 * (i + 1)) << std::endl;
0250
0251 std::cout << "East" << std::endl;
0252 for (int i = 0; i < 4; i++)
0253 std::cout << totalRegionEt.at(6 * (i + 1) + 5) << std::endl;
0254
0255 std::cout << "South" << std::endl;
0256 for (int i = 0; i < 4; i++)
0257 std::cout << totalRegionEt.at(31 + i) << std::endl;
0258
0259 std::cout << "NE " << totalRegionEt.at(5) << std::endl;
0260 std::cout << "SE " << totalRegionEt.at(35) << std::endl;
0261 std::cout << "NW " << totalRegionEt.at(0) << std::endl;
0262 std::cout << "SW " << totalRegionEt.at(30) << std::endl;
0263 }