CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
L1MuDTWedgeSorter Class Reference

#include <L1MuDTWedgeSorter.h>

Inheritance diagram for L1MuDTWedgeSorter:
L1AbstractProcessor

Public Member Functions

int id () const
 return Wedge Sorter identifier (0-11) More...
 
 L1MuDTWedgeSorter (const L1MuDTTrackFinder &, int id)
 constructor More...
 
void print () const
 print results after sorting More...
 
virtual void reset ()
 reset Wedge Sorter More...
 
virtual void run ()
 run Wedge Sorter More...
 
const std::vector< const
L1MuDTTrack * > & 
tracks () const
 return vector of muon candidates More...
 
virtual ~L1MuDTWedgeSorter ()
 destructor More...
 
- Public Member Functions inherited from L1AbstractProcessor
virtual void run (const edm::EventSetup &c)
 
virtual ~L1AbstractProcessor ()
 destructor More...
 

Private Member Functions

bool anyTrack () const
 are there any non-empty muon candidates in the Wedge Sorter? More...
 
void runCOL (std::vector< L1MuDTTrack * > &) const
 run the Cancel Out Logic of the wedge sorter More...
 

Static Private Member Functions

static bool neighbour (const L1MuDTSecProcId &spid1, const L1MuDTSecProcId &spid2)
 find out if two Sector Processors are neighbours in the same wedge More...
 

Private Attributes

const L1MuDTTrackFinderm_tf
 
std::vector< const L1MuDTTrack * > m_TrackCands
 
int m_wsid
 

Detailed Description

Wedge Sorter:

A Wedge Sorter receives 2 muon candidates from each of the 6 Sector Processors of a wedge and forwards the 2 highest rank candidates per wedge to the DT Muon Sorter

Date:
2007/02/27 11:44:00
Revision:
1.2

N. Neumeister CERN EP

Definition at line 47 of file L1MuDTWedgeSorter.h.

Constructor & Destructor Documentation

L1MuDTWedgeSorter::L1MuDTWedgeSorter ( const L1MuDTTrackFinder tf,
int  id 
)

constructor

Definition at line 52 of file L1MuDTWedgeSorter.cc.

References m_TrackCands.

52  :
53  m_tf(tf), m_wsid(id), m_TrackCands(2) {
54 
55  m_TrackCands.reserve(2);
56 
57 }
const L1MuDTTrackFinder & m_tf
std::vector< const L1MuDTTrack * > m_TrackCands
L1MuDTWedgeSorter::~L1MuDTWedgeSorter ( )
virtual

destructor

Definition at line 64 of file L1MuDTWedgeSorter.cc.

64  {
65 
66 }

Member Function Documentation

bool L1MuDTWedgeSorter::anyTrack ( ) const
private

are there any non-empty muon candidates in the Wedge Sorter?

Definition at line 179 of file L1MuDTWedgeSorter.cc.

References m_TrackCands.

Referenced by print().

179  {
180 
181  vector<const L1MuDTTrack*>::const_iterator iter = m_TrackCands.begin();
182  while ( iter != m_TrackCands.end() ) {
183  if ( *iter && !(*iter)->empty() ) return true;
184  iter++;
185  }
186 
187  return false;
188 
189 }
std::vector< const L1MuDTTrack * > m_TrackCands
int L1MuDTWedgeSorter::id ( void  ) const
inline

return Wedge Sorter identifier (0-11)

Definition at line 58 of file L1MuDTWedgeSorter.h.

References m_wsid.

58 { return m_wsid; }
bool L1MuDTWedgeSorter::neighbour ( const L1MuDTSecProcId spid1,
const L1MuDTSecProcId spid2 
)
staticprivate

find out if two Sector Processors are neighbours in the same wedge

Definition at line 249 of file L1MuDTWedgeSorter.cc.

References L1MuDTSecProcId::sector(), and L1MuDTSecProcId::wheel().

Referenced by runCOL().

250  {
251 
252  // neighbour definition:
253  // wheel 1 : -2, -1, +1, +1, +2
254  // wheel 2 : -3, -2, -1, +2, +3
255 
256  bool neigh = false;
257 
258  int sector1 = spid1.sector();
259  int wheel1 = spid1.wheel();
260 
261  int sector2 = spid2.sector();
262  int wheel2 = spid2.wheel();
263 
264  if ( sector1 == sector2 ) {
265 
266  if ( ( wheel1 == -2 && wheel2 == -3 ) ||
267  ( wheel1 == -1 && wheel2 == -2 ) ||
268  ( wheel1 == +1 && wheel2 == -1 ) ||
269  ( wheel1 == +1 && wheel2 == +2 ) ||
270  ( wheel1 == +2 && wheel2 == +3 ) ) neigh = true;
271 
272  }
273 
274  return neigh;
275 
276 }
int sector() const
return sector number
int wheel() const
return wheel number
void L1MuDTWedgeSorter::print ( void  ) const

print results after sorting

Definition at line 161 of file L1MuDTWedgeSorter.cc.

References anyTrack(), gather_cfg::cout, m_TrackCands, and m_wsid.

161  {
162 
163  if ( anyTrack() ) {
164  cout << "Muon candidates found in Wedge Sorter " << m_wsid << " : " << endl;
165  vector<const L1MuDTTrack*>::const_iterator iter = m_TrackCands.begin();
166  while ( iter != m_TrackCands.end() ) {
167  if ( *iter ) cout << *(*iter) << " found in "
168  << (*iter)->spid() << endl;
169  iter++;
170  }
171  }
172 
173 }
bool anyTrack() const
are there any non-empty muon candidates in the Wedge Sorter?
std::vector< const L1MuDTTrack * > m_TrackCands
tuple cout
Definition: gather_cfg.py:41
void L1MuDTWedgeSorter::reset ( void  )
virtual

reset Wedge Sorter

Implements L1AbstractProcessor.

Definition at line 148 of file L1MuDTWedgeSorter.cc.

References m_TrackCands.

148  {
149 
150  vector<const L1MuDTTrack*>::iterator iter;
151  for ( iter = m_TrackCands.begin(); iter != m_TrackCands.end(); iter++ ) {
152  *iter = 0;
153  }
154 
155 }
std::vector< const L1MuDTTrack * > m_TrackCands
void L1MuDTWedgeSorter::run ( void  )
virtual

run Wedge Sorter

Reimplemented from L1AbstractProcessor.

Definition at line 76 of file L1MuDTWedgeSorter.cc.

References L1MuDTTrack::address(), gather_cfg::cout, L1MuDTTFConfig::Debug(), L1MuDTTrack::empty(), m_tf, m_TrackCands, m_wsid, runCOL(), L1MuDTTrackFinder::sp(), and L1MuDTSectorProcessor::track().

76  {
77 
78  // get track candidates from Sector Processors
79  vector<L1MuDTTrack*> wedgecands;
80  wedgecands.reserve(12);
81 
82  int sector = m_wsid;
83  for ( int wheel = -3; wheel <= 3; wheel++ ) {
84  if ( wheel == 0 ) continue;
85  L1MuDTSecProcId tmpspid(wheel,sector);
86  for ( int number = 0; number < 2; number++ ) {
87  const L1MuDTTrack* cand = m_tf.sp(tmpspid)->track(number);
88  if ( cand && !cand->empty() ) {
89  // remove tracks which where found in wheel 0 and
90  // which didn't cross wheel boundaries (SP -1)
91  bool reject = false;
92  if ( wheel == -1 ) {
93  reject = true;
94  for ( int stat = 2; stat <= 4; stat++ ) {
95  int adr = cand->address(stat);
96  // check addresses : 0,1,4,5,8,9 (own wheel)
97  if ( adr != 15 ) reject &= ( (adr/2)%2 == 0 );
98  }
99  }
100  if ( !reject ) wedgecands.push_back(const_cast<L1MuDTTrack*>(cand));
101  }
102  }
103  }
104 
105  // print input data
106  if ( L1MuDTTFConfig::Debug(5) ) {
107  cout << "Wedge Sorter " << m_wsid << " input: "
108  << wedgecands.size() << endl;
109  vector<L1MuDTTrack*>::const_iterator iter;
110  for ( iter = wedgecands.begin(); iter != wedgecands.end(); iter++ ) {
111  if (*iter ) (*iter)->print();
112  }
113  }
114 
115  // print input data
116  runCOL(wedgecands);
117 
118  // remove disabled candidates
119  vector<L1MuDTTrack*>::iterator it = wedgecands.begin();
120  while ( it != wedgecands.end() ) {
121  if ( *it && (*it)->empty() ) {
122  wedgecands.erase(it);
123  it = wedgecands.begin(); continue;
124  }
125  it++;
126  }
127 
128  // sort candidates by pt and quality and copy the 2 best candidates
129  partial_sort_copy( wedgecands.begin(), wedgecands.end(),
130  m_TrackCands.begin(), m_TrackCands.end(),
131  L1MuDTTrack::Rank() );
132 
133  if ( L1MuDTTFConfig::Debug(4) ) {
134  cout << "Wedge Sorter " << m_wsid << " output: " << endl;
135  vector<const L1MuDTTrack*>::const_iterator iter;
136  for ( iter = m_TrackCands.begin();
137  iter != m_TrackCands.end(); iter++ ) {
138  if (*iter) (*iter)->print();
139  }
140  }
141 
142 }
const L1MuDTTrackFinder & m_tf
L1MuDTAddressArray address() const
get address-array for this muon candidate
Definition: L1MuDTTrack.h:98
const L1MuDTSectorProcessor * sp(const L1MuDTSecProcId &) const
get a pointer to a Sector Processor
std::vector< const L1MuDTTrack * > m_TrackCands
static bool Debug()
bool empty() const
is it an empty muon candidate?
Definition: L1MuDTTrack.h:92
void runCOL(std::vector< L1MuDTTrack * > &) const
run the Cancel Out Logic of the wedge sorter
define a rank for muon candidates
Definition: L1MuDTTrack.h:185
tuple cout
Definition: gather_cfg.py:41
L1MuDTTrack * track(int id) const
return pointer to muon candidate, index [0,1]
void L1MuDTWedgeSorter::runCOL ( std::vector< L1MuDTTrack * > &  cands) const
private

run the Cancel Out Logic of the wedge sorter

Definition at line 195 of file L1MuDTWedgeSorter.cc.

References gather_cfg::cout, L1MuDTTFConfig::Debug(), neighbour(), and L1MuDTSecProcId::wheel().

Referenced by run().

195  {
196 
197  // compare candidates which were found in nearby wheels:
198  // if 2 candidates have at least one track segment in common
199  // disable the one with lower quality;
200  // compare addresses from stations 2, 3 and 4
201 
202  typedef vector<L1MuDTTrack*>::iterator TI;
203  for ( TI iter1 = cands.begin(); iter1 != cands.end(); iter1++ ) {
204  if ( *iter1 == 0 ) continue;
205  if ( (*iter1)->empty() ) continue;
206  L1MuDTSecProcId sp1 = (*iter1)->spid();
207  int qual1 = (*iter1)->quality();
208  for ( TI iter2 = cands.begin(); iter2 != cands.end(); iter2++ ) {
209  if ( *iter2 == 0 ) continue;
210  if ( *iter1 == *iter2 ) continue;
211  if ( (*iter2)->empty() ) continue;
212  L1MuDTSecProcId sp2 = (*iter2)->spid();
213  int qual2 = (*iter2)->quality();
214  if ( sp1 == sp2 ) continue;
215  if ( !neighbour(sp1,sp2) ) continue;
216  int adr_shift = ( sp2.wheel() == -1 ) ? 0 : 2;
217  int countTS = 0;
218  for ( int stat = 2; stat <= 4; stat++ ) {
219  int adr1 = (*iter1)->address(stat);
220  int adr2 = (*iter2)->address(stat);
221  if ( adr1 == 15 || adr2 == 15 ) continue;
222  if ( (adr2/2)%2 == 1 ) continue;
223  if ( adr1 == adr2 + adr_shift ) countTS++;
224  }
225  if ( countTS > 0 ) {
226  if ( qual1 < qual2 ) {
227  if ( L1MuDTTFConfig::Debug(5) ) {
228  cout << "Wedge Sorter cancel : "; (*iter1)->print();
229  }
230  (*iter1)->disable();
231  break;
232  }
233  else {
234  if ( L1MuDTTFConfig::Debug(5) ) {
235  cout << "Wedge Sorter cancel : "; (*iter2)->print();
236  }
237  (*iter2)->disable();
238  }
239  }
240  }
241  }
242 
243 }
static bool neighbour(const L1MuDTSecProcId &spid1, const L1MuDTSecProcId &spid2)
find out if two Sector Processors are neighbours in the same wedge
static bool Debug()
int wheel() const
return wheel number
tuple cout
Definition: gather_cfg.py:41
const std::vector<const L1MuDTTrack*>& L1MuDTWedgeSorter::tracks ( void  ) const
inline

return vector of muon candidates

Definition at line 70 of file L1MuDTWedgeSorter.h.

References m_TrackCands.

Referenced by L1MuDTMuonSorter::run().

70 { return m_TrackCands; }
std::vector< const L1MuDTTrack * > m_TrackCands

Member Data Documentation

const L1MuDTTrackFinder& L1MuDTWedgeSorter::m_tf
private

Definition at line 85 of file L1MuDTWedgeSorter.h.

Referenced by run().

std::vector<const L1MuDTTrack*> L1MuDTWedgeSorter::m_TrackCands
private

Definition at line 88 of file L1MuDTWedgeSorter.h.

Referenced by anyTrack(), L1MuDTWedgeSorter(), print(), reset(), run(), and tracks().

int L1MuDTWedgeSorter::m_wsid
private

Definition at line 86 of file L1MuDTWedgeSorter.h.

Referenced by id(), print(), and run().