#include <L1Trigger/DTTriggerServerPhi/interface/DTTSS.h>
Public Member Functions | |
void | addDTTSCand (DTTSCand *cand) |
Add a TS candidate to the TSS, ifs is first/second track flag. | |
void | clear () |
Clear. | |
DTConfigTSPhi * | config () const |
Configuration set. | |
DTTSS (int) | |
Constructor. | |
DTTSCand * | getCarry () const |
Return the carry (for debugging). | |
DTTSCand * | getDTTSCand (int ifs, unsigned n) const |
Return requested TS candidate. | |
DTTSCand * | getTrack (int n) const |
Return the requested track. | |
const DTTracoTrigData * | getTracoT (int ifs, unsigned n) const |
Return requested TRACO trigger. | |
void | ignoreSecondTrack () |
Set a flag to skip sort2. | |
std::string | logWord (int n) const |
Return the requested log word. | |
int | nFirstT () const |
Return the number of input first tracks. | |
int | nSecondT () const |
Return the number of input second tracks. | |
int | nTracks () const |
Return the number of sorted tracks. | |
unsigned | nTracoT (int ifs) const |
Return the number of input tracks (first/second). | |
int | number () const |
Return identifier. | |
void | run () |
Run the TSS algorithm. | |
void | setConfig (DTConfigTSPhi *config) |
Set configuration. | |
DTTSCand * | sortTSS1 () |
Sort 1. | |
DTTSCand * | sortTSS2 () |
Sort 2. | |
~DTTSS () | |
Destructor. | |
Private Attributes | |
DTConfigTSPhi * | _config |
int | _ignoreSecondTrack |
std::string | _logWord1 |
std::string | _logWord2 |
int | _n |
std::vector< DTTSCand * > | _outcand |
std::vector< DTTSCand * > | _tctrig [2] |
Definition at line 38 of file DTTSS.h.
DTTSS::DTTSS | ( | int | n | ) |
Constructor.
Definition at line 36 of file DTTSS.cc.
References _logWord1, and _logWord2.
00036 : _n(n), _ignoreSecondTrack(0) { 00037 00038 // reserve the appropriate amount of space for vectors 00039 //_tctrig[0].reserve(DTConfigTSPhi::NTCTSS); 00040 //_tctrig[1].reserve(DTConfigTSPhi::NTCTSS); 00041 //_outcand.reserve(2); 00042 _logWord1 = "1/----"; 00043 _logWord2 = "2/----"; 00044 00045 }
DTTSS::~DTTSS | ( | ) |
Add a TS candidate to the TSS, ifs is first/second track flag.
Definition at line 290 of file DTTSS.cc.
References _tctrig, and DTTSCand::isFirst().
Referenced by DTTSPhi::addTracoT().
00290 { 00291 int ifs = (cand->isFirst()) ? 0 : 1; 00292 // std::cout << "SM DTTSS::addDTTSCand ifs = " << ifs << std::endl; 00293 _tctrig[ifs].push_back(cand); 00294 }
Clear.
Definition at line 61 of file DTTSS.cc.
References _ignoreSecondTrack, _logWord1, _logWord2, _outcand, and _tctrig.
Referenced by ~DTTSS().
00061 { 00062 _ignoreSecondTrack=0; 00063 for(int itk=0;itk<=1;itk++){ 00064 // content of _tctrig is deleted in the DTTSPhi 00065 _tctrig[itk].clear(); 00066 } 00067 // content of _outcand is deleted in the DTTSPhi 00068 _outcand.clear(); 00069 00070 // log words 00071 _logWord1 = "1/----"; 00072 _logWord2 = "2/----"; 00073 }
DTConfigTSPhi* DTTSS::config | ( | ) | const [inline] |
Configuration set.
Definition at line 73 of file DTTSS.h.
References _config.
Referenced by DTTSCand::config(), run(), sortTSS1(), and sortTSS2().
00073 { return _config; }
DTTSCand * DTTSS::getCarry | ( | ) | const |
Return requested TS candidate.
Definition at line 307 of file DTTSS.cc.
References _tctrig, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), nTracoT(), and p.
Referenced by getTracoT().
00307 { 00308 if(ifs<1||ifs>2){ 00309 std::cout << "DTTSS::getDTTSCand: wrong track number: " << ifs; 00310 std::cout << " empty pointer returned!" << std::endl; 00311 return 0; 00312 } 00313 if(n<1 || n>nTracoT(ifs)) { 00314 std::cout << "DTTSS::getDTTSCand: requested trigger not present: " << n; 00315 std::cout << " empty pointer returned!" << std::endl; 00316 return 0; 00317 } 00318 std::vector<DTTSCand*>::const_iterator p=_tctrig[ifs-1].begin()+n-1; 00319 return (*p); 00320 }
Return the requested track.
Definition at line 338 of file DTTSS.cc.
References _outcand, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), nTracks(), and p.
Referenced by sortTSS2().
00338 { 00339 if(n<1 || n>nTracks()) { 00340 std::cout << "DTTSS::getTrack: requested track not present: " << n; 00341 std::cout << " empty pointer returned!" << std::endl; 00342 return 0; 00343 } 00344 std::vector<DTTSCand*>::const_iterator p = _outcand.begin()+n-1; 00345 return (*p); 00346 }
const DTTracoTrigData * DTTSS::getTracoT | ( | int | ifs, | |
unsigned | n | |||
) | const |
Return requested TRACO trigger.
Definition at line 323 of file DTTSS.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), getDTTSCand(), nTracoT(), and DTTSCand::tracoTr().
00323 { 00324 if(ifs<1||ifs>2){ 00325 std::cout << "DTTSS::getTracoT: wrong track number: " << ifs; 00326 std::cout << " empty pointer returned!" << std::endl; 00327 return 0; 00328 } 00329 if(n<1 || n>nTracoT(ifs)) { 00330 std::cout << "DTTSS::getTracoT: requested trigger not present: " << n; 00331 std::cout << " empty pointer returned!" << std::endl; 00332 return 0; 00333 } 00334 return getDTTSCand(ifs, n)->tracoTr(); 00335 }
void DTTSS::ignoreSecondTrack | ( | ) | [inline] |
Set a flag to skip sort2.
Definition at line 55 of file DTTSS.h.
References _ignoreSecondTrack.
Referenced by DTTSPhi::ignoreSecondTrack().
00055 { _ignoreSecondTrack=1; }
std::string DTTSS::logWord | ( | int | n | ) | const |
Return the requested log word.
Definition at line 357 of file DTTSS.cc.
References _logWord1, _logWord2, GenMuonPlsPt100GeV_cfg::cout, and lat::endl().
00357 { 00358 std::string lw = ""; 00359 switch (n) { 00360 case 1: 00361 lw = _logWord1; break; 00362 case 2: 00363 lw = _logWord2; break; 00364 default: 00365 std::cout << "DTTSS::logWord: requested track not present: " << n; 00366 std::cout << " empty string returned!" << std::endl; 00367 } 00368 return lw; 00369 }
int DTTSS::nFirstT | ( | ) | const [inline] |
int DTTSS::nSecondT | ( | ) | const [inline] |
int DTTSS::nTracks | ( | ) | const [inline] |
Return the number of sorted tracks.
Definition at line 94 of file DTTSS.h.
References _outcand.
Referenced by getTrack(), and sortTSS2().
00094 { return _outcand.size(); }
unsigned DTTSS::nTracoT | ( | int | ifs | ) | const |
Return the number of input tracks (first/second).
Definition at line 297 of file DTTSS.cc.
References _tctrig, GenMuonPlsPt100GeV_cfg::cout, and lat::endl().
Referenced by getDTTSCand(), and getTracoT().
00297 { 00298 if(ifs<1||ifs>2){ 00299 std::cout << "DTTSS::nTracoT: wrong track number: " << ifs; 00300 std::cout << " 0 returned!" << std::endl; 00301 return 0; 00302 } 00303 return _tctrig[ifs-1].size(); 00304 }
int DTTSS::number | ( | ) | const [inline] |
Return identifier.
Definition at line 70 of file DTTSS.h.
References _n.
Referenced by DTTSPhi::addTracoT(), and DTTSCand::tssNumber().
00070 { return _n; }
Run the TSS algorithm.
Definition at line 76 of file DTTSS.cc.
References _n, _outcand, _tctrig, begin, config(), GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), first, nFirstT(), nSecondT(), p, edm::second(), sortTSS1(), and sortTSS2().
00076 { 00077 00078 if(config()->debug()){ 00079 std::cout << "DTTSS::run: Processing DTTSS number " << _n << " : "; 00080 std::cout << nFirstT() << " first & " << nSecondT() << " second tracks" << std::endl; 00081 } 00082 00083 if(nFirstT()<1)return; // skip if no first tracks 00084 // 00085 // SORT 1 00086 // 00087 // debugging 00088 if(config()->debug()){ 00089 std::cout << "Vector of first tracks in DTTSS: " << std::endl; 00090 std::vector<DTTSCand*>::const_iterator p; 00091 for(p=_tctrig[0].begin(); p!=_tctrig[0].end(); p++) { 00092 (*p)->print(); 00093 } 00094 } 00095 // end debugging 00096 00097 DTTSCand* first=sortTSS1(); 00098 if(first!=0) { 00099 _outcand.push_back(first); 00100 } 00101 00102 if(nSecondT()<1)return; // skip if no second tracks 00103 // 00104 // SORT 2 00105 // 00106 // debugging 00107 if(config()->debug()){ 00108 std::vector<DTTSCand*>::const_iterator p; 00109 std::cout << "Vector of second tracks (including carry) in DTTSS: " << std::endl; 00110 for(p=_tctrig[1].begin(); p!=_tctrig[1].end(); p++) { 00111 (*p)->print(); 00112 } 00113 } 00114 // end debugging 00115 00116 DTTSCand* second=sortTSS2(); 00117 if(second!=0) { 00118 _outcand.push_back(second); 00119 } 00120 00121 }
void DTTSS::setConfig | ( | DTConfigTSPhi * | config | ) | [inline] |
DTTSCand * DTTSS::sortTSS1 | ( | ) |
Sort 1.
Definition at line 124 of file DTTSS.cc.
References _logWord1, _tctrig, funct::abs(), begin, config(), DTTSCand::dataword(), DTTSCand::isCorr(), DTTSCand::isFirst(), DTTSCand::isInner(), p, DTTSCand::setBitsTss(), DTTSCand::setSecondTrack(), DTTSCand::TcPos(), and DTConfigTSPhi::TssGhost1Corr().
Referenced by run().
00124 { 00125 00126 // Do a sort 1 00127 DTTSCand* best=0; 00128 DTTSCand* carry=0; 00129 std::vector<DTTSCand*>::iterator p; 00130 for(p=_tctrig[0].begin(); p!=_tctrig[0].end(); p++) { 00131 DTTSCand* curr= (*p) ? (*p) : 0; 00132 // SM sector collector Set bits for tss 00133 curr->setBitsTss(); 00134 if(curr->dataword()==0x1ff)continue; 00135 _logWord1[1+curr->TcPos()] = (curr->isFirst()) ? '1' : '2'; 00136 // std::cout << "Running TSS: --->curr->dataword() sort 1 " << curr->dataword() << std::endl; 00137 if(best==0){ 00138 best=curr; 00139 } 00140 else if((*curr)<=(*best)){ 00141 carry=best; 00142 best=curr; 00143 } 00144 else if(carry==0){ 00145 carry=curr; 00146 } 00147 else if((*curr)<=(*carry)){ 00148 carry=curr; 00149 } 00150 } 00151 00152 // Ghost 1 suppression: use carry only if not suppressed 00153 00154 if(carry!=0) { // A carry is present 00155 00156 // Carry enabled if correlated and TRACO is next to best 00157 bool inner_or_corr; 00158 if(config()->TssGhost1Corr()) 00159 {inner_or_corr=carry->isInner() || carry->isCorr(); 00160 00161 } 00162 else 00163 {inner_or_corr=carry->isInner(); 00164 00165 } 00166 if(config()->TssGhost1Flag()<2 && ( // Carry isn't always suppressed 00167 config()->TssGhost1Flag()==0 || // Carry always enabled 00168 // carry->isInner() || // Carry is inner 00169 inner_or_corr || // carry is inner or corr 00170 abs(carry->TcPos()-best->TcPos())!=1) // Carry not adj. to best 00171 ) { 00172 // add carry to second tracks for sort 2 00173 carry->setSecondTrack(); // change value of first/second track bit 00174 carry->setBitsTss(); // set quality bits as for second tracks 00175 _tctrig[1].push_back(carry); // add to list of second tracks 00176 } else { 00177 _logWord1[1+carry->TcPos()] = 'g'; 00178 } 00179 } 00180 00181 /* 00182 if(carry!=0 && config()->TssGhost1Flag()<2){ // Carry isn't always suppressed 00183 if(config()->TssGhost1Flag()==0 || // Carry always enabled 00184 carry->isInner() || // Carry is inner 00185 abs(carry->TcPos()-best->TcPos())!=1) { // Carry not adj. to best 00186 // add carry to second tracks to for sort 2 00187 carry->setSecondTrack(); // change value of first/second track bit 00188 carry->setBitsTss(); // set quality bits as for second tracks 00189 _tctrig[1].push_back(carry); // add to list of second tracks 00190 } 00191 } 00192 */ 00193 //std::cout << " best TSS sort 1 = " << best->dataword() << std::endl; 00194 //std::cout << " SM end of TSS sort 1: best = " << std::endl; 00195 //best->print(); 00196 00197 return best; 00198 00199 }
DTTSCand * DTTSS::sortTSS2 | ( | ) |
Sort 2.
curr->isInner() && // outer track
Definition at line 202 of file DTTSS.cc.
References _ignoreSecondTrack, _logWord2, _tctrig, begin, config(), GenMuonPlsPt100GeV_cfg::cout, DTTSCand::dataword(), lat::endl(), getTrack(), DTTSCand::isCarry(), DTTSCand::isCorr(), DTTSCand::isFirst(), DTTSCand::isInner(), nTracks(), p, edm::second(), DTTSCand::setBitsTss(), DTTSCand::TcPos(), DTConfigTSPhi::TssGhost2Corr(), and DTConfigTSPhi::TssGhost2Flag().
Referenced by run().
00202 { 00203 00204 // Check if there are second tracks 00205 if(nTracks()<1){ 00206 std::cout << "DTTSS::DTTSSsort2: called with no first track."; 00207 std::cout << " empty pointer returned!" << std::endl; 00208 return 0; 00209 } 00210 00211 if(_ignoreSecondTrack){ 00212 // At the time being if a a first track at the following BX is present, 00213 // the carry is thrown 00214 // std::vector<DTTSCand*>::iterator p; 00215 // for(p=_tctrig[1].begin(); p!=_tctrig[1].end(); p++) { 00216 // if((*p)->isCarry()) return (*p); 00217 // } 00218 // Fill log word 00219 std::vector<DTTSCand*>::iterator p; 00220 for(p=_tctrig[1].begin(); p!=_tctrig[1].end(); p++) 00221 if(!(*p)->isCarry())_logWord2[1+(*p)->TcPos()] = 'o'; // out of time 00222 return 0; 00223 } 00224 00225 // If second tracks are always suppressed skip processing 00226 if(config()->TssGhost2Flag()==3) { 00227 // Fill log word 00228 std::vector<DTTSCand*>::iterator p; 00229 for(p=_tctrig[1].begin(); p!=_tctrig[1].end(); p++) 00230 _logWord2[1+(*p)->TcPos()] = 'G'; 00231 return 0; 00232 } 00233 00234 // If no first tracks at the following BX, do a sort 2 00235 DTTSCand* best=getTrack(1); 00236 DTTSCand* second=0; 00237 std::vector<DTTSCand*>::iterator p; 00238 for(p=_tctrig[1].begin(); p!=_tctrig[1].end(); p++) { 00239 DTTSCand* curr=(*p); 00240 // SM sector collector set bits for tss 00241 curr->setBitsTss(); 00242 // std::cout << "Running TSS sort 2: --- curr->dataword() " << curr->dataword() << std::endl; 00243 if(!curr->isCarry()) { 00244 _logWord2[1+curr->TcPos()] = (curr->isFirst()) ? '1' : '2'; 00245 if(curr->dataword()==0x1ff)continue; 00246 } 00247 // ghost 2 suppression: skip track if suppressed 00248 if(config()->TssGhost2Flag()!=0){ // 2nd tracks not always enabled 00249 00250 bool inner_or_corr; 00251 if(config()->TssGhost2Corr()) 00252 {inner_or_corr=curr->isInner() || curr->isCorr(); 00253 00254 } 00255 else 00256 {inner_or_corr=curr->isInner(); 00257 00258 } 00259 00260 if( 00262 !inner_or_corr && // outer and not corr 00263 curr->TcPos()==best->TcPos()) { // same correlator of 1st track 00264 if(config()->TssGhost2Flag()==2 || // do not look to corr bit of 1st 00265 (!best->isCorr() ) && config()->TssGhost2Flag()!=4 || // skip if best is not corr 00266 (!best->isCorr() ) && best->isInner() && config()->TssGhost2Flag()==4 ) // skip only if best is inner and not corr 00267 { 00268 _logWord2[1+curr->TcPos()] = 'G'; 00269 // std::cout << " skip sort 2 in TSS" << std::endl; 00270 continue; // skip track 00271 } 00272 } 00273 } 00274 if(second==0){ 00275 second=curr; 00276 } 00277 else if((*curr)<=(*second)){ 00278 second=curr; 00279 } 00280 } 00281 // if(!second==0) {std::cout << " best sort 2 = " << second->dataword() << std::endl; 00282 // std::cout << " SM end of TSS sort 2: second = " << std::endl; 00283 // second->print(); } 00284 00285 return second; 00286 00287 }
DTConfigTSPhi* DTTSS::_config [private] |
int DTTSS::_ignoreSecondTrack [private] |
std::string DTTSS::_logWord1 [private] |
std::string DTTSS::_logWord2 [private] |
std::vector<DTTSCand*> DTTSS::_outcand [private] |
std::vector<DTTSCand*> DTTSS::_tctrig[2] [private] |
Definition at line 110 of file DTTSS.h.
Referenced by addDTTSCand(), clear(), getCarry(), getDTTSCand(), nFirstT(), nSecondT(), nTracoT(), run(), sortTSS1(), and sortTSS2().