49 m_tf(tf), m_TrackCands() {
75 vector<L1MuDTTrack*> mycands;
78 for (
int wedge = 0; wedge < 12; wedge++ ) {
79 vector<const L1MuDTTrack*> wscand =
m_tf.
ws(wedge)->
tracks();
80 vector<const L1MuDTTrack*>::iterator iter = wscand.begin();
81 while ( iter != wscand.end() ) {
82 if ( *iter && !(*iter)->empty() )
83 mycands.push_back(const_cast<L1MuDTTrack*>(*iter) );
90 cout <<
"DT Muon Sorter input: " 91 << mycands.size() << endl;
92 vector<L1MuDTTrack*>::const_iterator iter;
93 for ( iter = mycands.begin(); iter != mycands.end(); iter++ ) {
94 if (*iter ) (*iter)->print();
102 vector<L1MuDTTrack*>::iterator it = mycands.begin();
103 while ( it != mycands.end() ) {
104 if ( *it && (*it)->empty() ) {
106 it = mycands.begin();
continue;
115 int number_of_tracks = 0;
116 vector<L1MuDTTrack*>::const_iterator iter1 = mycands.begin();
117 while ( iter1 != mycands.end() ) {
118 if ( *iter1 && number_of_tracks < 4 ) {
134 vector<const L1MuDTTrack*>::iterator iter;
148 cout <<
"Muon candidates found by the barrel MTTF : " 150 vector<const L1MuDTTrack*>::const_iterator iter =
m_TrackCands.begin();
152 if ( *iter )
cout << *(*iter) << endl;
170 typedef vector<L1MuDTTrack*>::iterator TI;
171 for ( TI iter1 = cands.begin(); iter1 != cands.end(); iter1++ ) {
172 if ( *iter1 ==
nullptr )
continue;
173 if ( (*iter1)->empty() )
continue;
175 int qual1 = (*iter1)->quality();
176 for ( TI iter2 = cands.begin(); iter2 != cands.end(); iter2++ ) {
177 if ( *iter2 ==
nullptr )
continue;
178 if ( *iter1 == *iter2 )
continue;
179 if ( (*iter2)->empty() )
continue;
181 int qual2 = (*iter2)->quality();
182 if (sp1 == sp2 )
continue;
184 if ( topology == -1 )
continue;
187 int adr1 = (*iter1)->address(
stat);
188 int adr2 = (*iter2)->address(
stat);
189 if ( adr1 == 15 || adr2 == 15 )
continue;
190 switch ( topology ) {
192 if ( adr1 > 7 )
continue;
193 if ( adr2 > 3 && adr2 < 8 )
continue;
194 int adr_shift = ( adr2 > 7 ) ? -8 : 4;
195 if ( adr1 == adr2+adr_shift ) countTS++;
199 if ( adr2 > 7 )
continue;
200 if ( adr1 > 3 && adr1 < 8 )
continue;
201 int adr_shift = ( adr2 > 3 ) ? -4 : 8;
202 if ( adr1 == adr2+adr_shift ) countTS++;
206 if ( ( adr1 == 6 && adr2 == 0 ) ||
207 ( adr1 == 7 && adr2 == 1 ) ||
208 ( adr1 == 2 && adr2 == 8 ) ||
209 ( adr1 == 3 && adr2 == 9 ) ) countTS++;
213 if ( ( adr1 == 2 && adr2 == 4 ) ||
214 ( adr1 == 3 && adr2 == 5 ) ||
215 ( adr1 == 10 && adr2 == 0 ) ||
216 ( adr1 == 11 && adr2 == 1 ) ) countTS++;
220 if ( ( adr1 == 0 && adr2 == 8 ) ||
221 ( adr1 == 1 && adr2 == 9 ) ||
222 ( adr1 == 4 && adr2 == 0 ) ||
223 ( adr1 == 5 && adr2 == 1 ) ) countTS++;
227 if ( ( adr1 == 0 && adr2 == 4 ) ||
228 ( adr1 == 1 && adr2 == 5 ) ||
229 ( adr1 == 8 && adr2 == 0 ) ||
230 ( adr1 == 9 && adr2 == 1 ) ) countTS++;
237 if ( qual1 < qual2 ) {
239 cout <<
"Muon Sorter cancel : "; (*iter1)->print();
246 cout <<
"Muon Sorter cancel : "; (*iter2)->print();
258 for ( TI iter1 = cands.begin(); iter1 != cands.end(); iter1++ ) {
259 if ( *iter1 ==
nullptr )
continue;
260 if ( (*iter1)->empty() )
continue;
261 int phi1 = (*iter1)->phi();
262 int pt1 = (*iter1)->pt();
263 int qual1 = (*iter1)->quality();
264 for ( TI iter2 = cands.begin(); iter2 != cands.end(); iter2++ ) {
265 if ( *iter2 ==
nullptr )
continue;
266 if ( *iter1 == *iter2 )
continue;
267 if ( (*iter2)->empty() )
continue;
268 int phi2 = (*iter2)->phi();
269 int pt2 = (*iter2)->pt();
270 int qual2 = (*iter2)->quality();
271 int w1 = (*iter1)->getStartTSphi().wheel();
272 int w2 = (*iter2)->getStartTSphi().wheel();
273 int phidiff = (phi2 - phi1)%144;
274 if ( phidiff >= 72 ) phidiff -= 144;
275 if ( phidiff < -72 ) phidiff += 144;
276 if (
abs(phidiff) < 2 && (w1 ==
w2) ) {
277 int rank1 = 10 * pt1 + qual1;
278 int rank2 = 10 * pt2 + qual2;
280 cout <<
"========================================" << endl;
281 cout <<
" special cancellation : " << endl;
282 (*iter1)->print();
if ( rank1 < rank2 )
cout <<
"cancelled" << endl;
283 (*iter2)->print();
if ( rank1 >= rank2 )
cout <<
"cancelled" << endl;
284 cout <<
"========================================" << endl;
286 if ( rank1 >= rank2 ) (*iter2)->disable();
287 if ( rank1 < rank2 ) { (*iter1)->disable();
break; }
320 int sector1 = spid1.
sector();
321 int wheel1 = spid1.
wheel();
323 int sector2 = spid2.
sector();
324 int wheel2 = spid2.
wheel();
326 int sectordiff = (sector2 - sector1)%12;
327 if ( sectordiff >= 6 ) sectordiff -= 12;
328 if ( sectordiff < -6 ) sectordiff += 12;
330 if (
abs(sectordiff) == 1 ) {
332 if ( wheel1 == wheel2 ) topology = (sectordiff > 0) ? 1 : 2;
333 if ( wheel1 == +1 && wheel2 == -1 ) topology = (sectordiff > 0) ? 5 : 6;
334 if ( ( wheel1 == -2 && wheel2 == -3 ) ||
335 ( wheel1 == -1 && wheel2 == -2 ) ||
336 ( wheel1 == +1 && wheel2 == +2 ) ||
337 ( wheel1 == +2 && wheel2 == +3 ) ) topology = (sectordiff > 0) ? 3 : 4;
common ppss p3p6s2 common epss epspn46 common const1 w2
CaloTopology const * topology(0)
static bool rank(const L1MuDTTrack *first, const L1MuDTTrack *second)
define a rank for muon candidates
static int neighbour(const L1MuDTSecProcId &spid1, const L1MuDTSecProcId &spid2)
find out if two Sector Processors are neighbours
void print() const
print results after sorting
double phidiff(double phi)
Normalized difference in azimuthal angles to a range between .
void runCOL(std::vector< L1MuDTTrack * > &) const
run the Cancel Out Logic of the muon sorter
const std::vector< const L1MuDTTrack * > & tracks() const
return vector of muon candidates
int sector() const
return sector number
Abs< T >::type abs(const T &t)
void run() override
run Muon Sorter
void reset() override
reset Muon Sorter
std::vector< const L1MuDTTrack * > m_TrackCands
int numberOfTracks() const
return number of found muon candidates after sorter
const L1MuDTTrackFinder & m_tf
L1MuDTMuonSorter(const L1MuDTTrackFinder &)
constructor
~L1MuDTMuonSorter() override
destructor
const L1MuDTWedgeSorter * ws(int id) const
get a pointer to a Wedge Sorter, index [0-11]
int wheel() const
return wheel number