Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "L1Trigger/DTTriggerServerPhi/interface/DTTSCand.h"
00020
00021
00022
00023
00024 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigTSPhi.h"
00025
00026
00027
00028
00029 #include <iostream>
00030
00031
00032
00033
00034
00035
00036 DTTSCand::DTTSCand(DTTSS* tss, const DTTracoTrigData* tctrig,
00037 int ifs, int pos)
00038 : _tss(tss), _tctrig(tctrig), _tcPos(pos), _isCarry(0) {
00039
00040 _dataword.one();
00041
00042
00043
00044 if(ifs==1)_dataword.unset(14);
00045
00046 }
00047
00048 DTTSCand::DTTSCand(const DTTSCand& tscand)
00049 : _tss(tscand._tss), _tctrig(tscand._tctrig), _tcPos(tscand._tcPos),
00050 _isCarry(tscand._isCarry) {
00051
00052
00053 }
00054
00055
00056 DTTSCand::DTTSCand() {}
00057
00058
00059
00060
00061 DTTSCand::~DTTSCand(){
00062 }
00063
00064
00065
00066
00067
00068
00069 DTTSCand&
00070 DTTSCand::operator=(const DTTSCand& tscand) {
00071 if(this != &tscand){
00072 _tss = tscand._tss;
00073 _tctrig = tscand._tctrig;
00074 _tcPos = tscand._tcPos;
00075 _isCarry = tscand._isCarry;
00076 }
00077 return *this;
00078 }
00079
00080 void
00081 DTTSCand::clear() {
00082 _tctrig=0;
00083 _dataword.one();
00084
00085 _isCarry=0;
00086
00087 }
00088
00089 void
00090 DTTSCand::setBitsTss() {
00091
00092 int itk=_dataword.element(14);
00093
00094 clearBits();
00095 if(_tctrig->pvK()>32|| _tctrig->pvK()<0){
00096 std::cout << "DTTSCand::setBitsTss() pvK outside valid range: " << _tctrig->pvK();
00097 std::cout << " deltaPsiR set to 31" << std::endl;
00098 }
00099 else {
00100
00101 _dataword.assign(0,5,_tctrig->pvK());
00102
00103
00104 int posH=-1;
00105 int posI=-1;
00106 int posC=-1;
00107 switch(config()->TssMasking(itk)) {
00108 case 123:
00109 posH = 7;
00110 posI = 6;
00111 posC = 5;
00112 break;
00113 case 132:
00114 posH = 7;
00115 posI = 5;
00116 posC = 6;
00117 break;
00118 case 213:
00119 posH = 6;
00120 posI = 7;
00121 posC = 5;
00122 break;
00123 case 231:
00124 posH = 5;
00125 posI = 7;
00126 posC = 6;
00127 break;
00128 case 312:
00129 posH = 6;
00130 posI = 5;
00131 posC = 7;
00132 break;
00133 case 321:
00134 posH = 5;
00135 posI = 6;
00136 posC = 7;
00137 break;
00138 default:
00139 std::cout << "DTTSCand::DTTSCand(): masking not correct: ";
00140 std::cout << config()->TssMasking(itk);
00141 std::cout << " All bits set to 1" << std::endl;
00142 }
00143
00144 bool enaH = config()->TssHtrigEna(itk);
00145 bool enaI = config()->TssInOutEna(itk);
00146 bool enaC = config()->TssCorrEna(itk) ;
00147 if(isCarry()) {
00148
00149 enaH = config()->TssHtrigEnaCarry();
00150 enaI = config()->TssInOutEnaCarry();
00151 enaC = config()->TssCorrEnaCarry() ;
00152 }
00153
00154 if(isHtrig()&&enaH&&posH>0)_dataword.unset(posH);
00155 if(isInner()&&enaI&&posI>0)_dataword.unset(posI);
00156 if(isCorr() &&enaC&&posC>0)_dataword.unset(posC);
00157 }
00158
00159 }
00160
00161
00162 void
00163 DTTSCand::setBitsBkmod() {
00164
00165 clearBitsBkmod();
00166
00167
00168 int a2 = 6;
00169 int a1 = 5;
00170 int a0 = 4;
00171
00172
00173 if( _tctrig->qdec()==6 ) { _dataword.unset(a2); _dataword.unset(a1); _dataword.unset(a0); }
00174 if( _tctrig->qdec()==5 ) { _dataword.unset(a2); _dataword.unset(a1); }
00175 if( _tctrig->qdec()==4 ) { _dataword.unset(a2); _dataword.unset(a0); }
00176 if( _tctrig->qdec()==3 ) { _dataword.unset(a1); }
00177 if( _tctrig->qdec()==2 ) { _dataword.unset(a1); _dataword.unset(a0); }
00178
00179 if( _tctrig->qdec()==0 ) { _dataword.unset(a0); }
00180
00181
00182 }
00183
00184
00185 void
00186 DTTSCand::setBitsTsm() {
00187
00188 int itk=_dataword.element(14);
00189
00190 clearBits();
00191
00192 if(_tctrig->pvK()>31|| _tctrig->pvK()<0){
00193 std::cout << "DTTSCand::setBitsTsm pvK outside valid range: " << _tctrig->pvK();
00194 std::cout << " deltaPsiR set to 31" << std::endl;
00195 }
00196 else {
00197
00198
00199 _dataword.assign(0,5,_tctrig->pvK());
00200
00201
00202
00203 int posH=-1;
00204 int posI=-1;
00205 int posC=-1;
00206 switch(config()->TsmMasking(itk)) {
00207 case 123:
00208 posH = 7;
00209 posI = 6;
00210 posC = 5;
00211 break;
00212 case 132:
00213 posH = 7;
00214 posI = 5;
00215 posC = 6;
00216 break;
00217 case 213:
00218 posH = 6;
00219 posI = 7;
00220 posC = 5;
00221 break;
00222 case 231:
00223 posH = 5;
00224 posI = 7;
00225 posC = 6;
00226 break;
00227 case 312:
00228 posH = 6;
00229 posI = 5;
00230 posC = 7;
00231 break;
00232 case 321:
00233 posH = 5;
00234 posI = 6;
00235 posC = 7;
00236 break;
00237 default:
00238 std::cout << "DTTSCand::DTTSCand(): masking not correct: ";
00239 std::cout << config()->TssMasking(itk);
00240 std::cout << " All bits set to 1" << std::endl;
00241
00242
00243 bool enaH = config()->TsmHtrigEna(itk);
00244 bool enaI = config()->TsmInOutEna(itk);
00245 bool enaC = config()->TsmCorrEna(itk) ;
00246 if(isCarry()) {
00247
00248 enaH = config()->TsmHtrigEnaCarry();
00249 enaI = config()->TsmInOutEnaCarry();
00250 enaC = config()->TsmCorrEnaCarry() ;
00251 }
00252
00253 if(isHtrig()&&enaH&&posH>0)_dataword.unset(posH);
00254 if(isInner()&&enaI&&posI>0)_dataword.unset(posI);
00255 if(isCorr() &&enaC&&posC>0)_dataword.unset(posC);
00256
00257 }
00258 }
00259
00260
00261 }
00262 void
00263 DTTSCand::print() const {
00264 std::cout << " First=" << isFirst();
00265 std::cout << " HTRIG=" << isHtrig();
00266 std::cout << " Inner=" << isInner();
00267 std::cout << " Corr=" << isCorr();
00268 std::cout << " Kpv=" << tracoTr()->pvK();
00269 std::cout << " dataword=";
00270 _dataword.print();
00271 std::cout << std::endl;
00272 }
00273