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

N. Neumeister CERN EP

Definition at line 45 of file L1MuDTWedgeSorter.h.

Constructor & Destructor Documentation

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

constructor

Definition at line 50 of file L1MuDTWedgeSorter.cc.

References m_TrackCands.

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

destructor

Definition at line 62 of file L1MuDTWedgeSorter.cc.

62  {
63 
64 }

Member Function Documentation

bool L1MuDTWedgeSorter::anyTrack ( ) const
private

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

Definition at line 177 of file L1MuDTWedgeSorter.cc.

References m_TrackCands.

Referenced by print().

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

return Wedge Sorter identifier (0-11)

Definition at line 56 of file L1MuDTWedgeSorter.h.

References m_wsid.

56 { 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 247 of file L1MuDTWedgeSorter.cc.

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

Referenced by runCOL().

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

print results after sorting

Definition at line 159 of file L1MuDTWedgeSorter.cc.

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

159  {
160 
161  if ( anyTrack() ) {
162  cout << "Muon candidates found in Wedge Sorter " << m_wsid << " : " << endl;
163  vector<const L1MuDTTrack*>::const_iterator iter = m_TrackCands.begin();
164  while ( iter != m_TrackCands.end() ) {
165  if ( *iter ) cout << *(*iter) << " found in "
166  << (*iter)->spid() << endl;
167  iter++;
168  }
169  }
170 
171 }
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:121
void L1MuDTWedgeSorter::reset ( void  )
virtual

reset Wedge Sorter

Implements L1AbstractProcessor.

Definition at line 146 of file L1MuDTWedgeSorter.cc.

References m_TrackCands.

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

run Wedge Sorter

Reimplemented from L1AbstractProcessor.

Definition at line 74 of file L1MuDTWedgeSorter.cc.

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

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

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

Referenced by run().

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

return vector of muon candidates

Definition at line 68 of file L1MuDTWedgeSorter.h.

References m_TrackCands.

Referenced by L1MuDTMuonSorter::run().

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

Member Data Documentation

const L1MuDTTrackFinder& L1MuDTWedgeSorter::m_tf
private

Definition at line 83 of file L1MuDTWedgeSorter.h.

Referenced by run().

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

Definition at line 86 of file L1MuDTWedgeSorter.h.

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

int L1MuDTWedgeSorter::m_wsid
private

Definition at line 84 of file L1MuDTWedgeSorter.h.

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