File indexing completed on 2024-04-06 12:19:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include "L1Trigger/DTTriggerServerPhi/interface/DTTSCand.h"
0020
0021
0022
0023
0024 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigTSPhi.h"
0025
0026
0027
0028
0029 #include <iostream>
0030
0031
0032
0033
0034
0035
0036 DTTSCand::DTTSCand(DTTSS *tss, const DTTracoTrigData *tctrig, int ifs, int pos)
0037 : _tss(tss), _tctrig(tctrig), _tcPos(pos), _isCarry(0) {
0038 _dataword.one();
0039
0040
0041
0042
0043 if (ifs == 1)
0044 _dataword.unset(14);
0045 }
0046
0047 DTTSCand::DTTSCand(const DTTSCand &tscand)
0048 : _tss(tscand._tss), _tctrig(tscand._tctrig), _tcPos(tscand._tcPos), _isCarry(tscand._isCarry) {}
0049
0050 DTTSCand::DTTSCand() {}
0051
0052
0053
0054
0055 DTTSCand::~DTTSCand() {}
0056
0057
0058
0059
0060
0061 DTTSCand &DTTSCand::operator=(const DTTSCand &tscand) {
0062 if (this != &tscand) {
0063 _tss = tscand._tss;
0064 _tctrig = tscand._tctrig;
0065 _tcPos = tscand._tcPos;
0066 _isCarry = tscand._isCarry;
0067 }
0068 return *this;
0069 }
0070
0071 void DTTSCand::clear() {
0072 _tctrig = nullptr;
0073 _dataword.one();
0074
0075 _isCarry = 0;
0076 }
0077
0078 void DTTSCand::setBitsTss() {
0079
0080 int itk = _dataword.element(14);
0081
0082 clearBits();
0083 if (_tctrig->pvK() > 32 || _tctrig->pvK() < 0) {
0084 std::cout << "DTTSCand::setBitsTss() pvK outside valid range: " << _tctrig->pvK();
0085 std::cout << " deltaPsiR set to 31" << std::endl;
0086 } else {
0087
0088 _dataword.assign(0, 5, _tctrig->pvK());
0089
0090
0091 int posH = -1;
0092 int posI = -1;
0093 int posC = -1;
0094 switch (config()->TssMasking(itk)) {
0095 case 123:
0096 posH = 7;
0097 posI = 6;
0098 posC = 5;
0099 break;
0100 case 132:
0101 posH = 7;
0102 posI = 5;
0103 posC = 6;
0104 break;
0105 case 213:
0106 posH = 6;
0107 posI = 7;
0108 posC = 5;
0109 break;
0110 case 231:
0111 posH = 5;
0112 posI = 7;
0113 posC = 6;
0114 break;
0115 case 312:
0116 posH = 6;
0117 posI = 5;
0118 posC = 7;
0119 break;
0120 case 321:
0121 posH = 5;
0122 posI = 6;
0123 posC = 7;
0124 break;
0125 default:
0126 std::cout << "DTTSCand::DTTSCand(): masking not correct: ";
0127 std::cout << config()->TssMasking(itk);
0128 std::cout << " All bits set to 1" << std::endl;
0129 }
0130
0131 bool enaH = config()->TssHtrigEna(itk);
0132 bool enaI = config()->TssInOutEna(itk);
0133 bool enaC = config()->TssCorrEna(itk);
0134 if (isCarry()) {
0135
0136 enaH = config()->TssHtrigEnaCarry();
0137 enaI = config()->TssInOutEnaCarry();
0138 enaC = config()->TssCorrEnaCarry();
0139 }
0140
0141 if (isHtrig() && enaH && posH > 0)
0142 _dataword.unset(posH);
0143 if (isInner() && enaI && posI > 0)
0144 _dataword.unset(posI);
0145 if (isCorr() && enaC && posC > 0)
0146 _dataword.unset(posC);
0147 }
0148 }
0149
0150 void DTTSCand::setBitsBkmod() {
0151
0152
0153 clearBitsBkmod();
0154
0155
0156
0157 int a2 = 6;
0158 int a1 = 5;
0159 int a0 = 4;
0160
0161
0162 if (_tctrig->qdec() == 6) {
0163 _dataword.unset(a2);
0164 _dataword.unset(a1);
0165 _dataword.unset(a0);
0166 }
0167 if (_tctrig->qdec() == 5) {
0168 _dataword.unset(a2);
0169 _dataword.unset(a1);
0170 }
0171 if (_tctrig->qdec() == 4) {
0172 _dataword.unset(a2);
0173 _dataword.unset(a0);
0174 }
0175 if (_tctrig->qdec() == 3) {
0176 _dataword.unset(a1);
0177 }
0178 if (_tctrig->qdec() == 2) {
0179 _dataword.unset(a1);
0180 _dataword.unset(a0);
0181 }
0182
0183 if (_tctrig->qdec() == 0) {
0184 _dataword.unset(a0);
0185 }
0186
0187
0188 }
0189
0190 void DTTSCand::setBitsTsm() {
0191
0192 int itk = _dataword.element(14);
0193
0194 clearBits();
0195
0196 if (_tctrig->pvK() > 31 || _tctrig->pvK() < 0) {
0197 std::cout << "DTTSCand::setBitsTsm pvK outside valid range: " << _tctrig->pvK();
0198 std::cout << " deltaPsiR set to 31" << std::endl;
0199 } else {
0200
0201
0202 _dataword.assign(0, 5, _tctrig->pvK());
0203
0204
0205
0206 int posH = -1;
0207 int posI = -1;
0208 int posC = -1;
0209 switch (config()->TsmMasking(itk)) {
0210 case 123:
0211 posH = 7;
0212 posI = 6;
0213 posC = 5;
0214 break;
0215 case 132:
0216 posH = 7;
0217 posI = 5;
0218 posC = 6;
0219 break;
0220 case 213:
0221 posH = 6;
0222 posI = 7;
0223 posC = 5;
0224 break;
0225 case 231:
0226 posH = 5;
0227 posI = 7;
0228 posC = 6;
0229 break;
0230 case 312:
0231 posH = 6;
0232 posI = 5;
0233 posC = 7;
0234 break;
0235 case 321:
0236 posH = 5;
0237 posI = 6;
0238 posC = 7;
0239 break;
0240 default:
0241 std::cout << "DTTSCand::DTTSCand(): masking not correct: ";
0242 std::cout << config()->TssMasking(itk);
0243 std::cout << " All bits set to 1" << std::endl;
0244
0245
0246 bool enaH = config()->TsmHtrigEna(itk);
0247 bool enaI = config()->TsmInOutEna(itk);
0248 bool enaC = config()->TsmCorrEna(itk);
0249 if (isCarry()) {
0250
0251 enaH = config()->TsmHtrigEnaCarry();
0252 enaI = config()->TsmInOutEnaCarry();
0253 enaC = config()->TsmCorrEnaCarry();
0254 }
0255
0256 if (isHtrig() && enaH && posH > 0)
0257 _dataword.unset(posH);
0258 if (isInner() && enaI && posI > 0)
0259 _dataword.unset(posI);
0260 if (isCorr() && enaC && posC > 0)
0261 _dataword.unset(posC);
0262 }
0263 }
0264 }
0265 void DTTSCand::print() const {
0266 std::cout << " First=" << isFirst();
0267 std::cout << " HTRIG=" << isHtrig();
0268 std::cout << " Inner=" << isInner();
0269 std::cout << " Corr=" << isCorr();
0270 std::cout << " Kpv=" << tracoTr()->pvK();
0271 std::cout << " dataword=";
0272 _dataword.print();
0273 std::cout << std::endl;
0274 }