CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
L1MuDTWedgeSorter Class Reference

#include <L1MuDTWedgeSorter.h>

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...
 
void reset ()
 reset Wedge Sorter More...
 
void run ()
 run Wedge Sorter More...
 
const std::vector< const L1MuDTTrack * > & tracks () const
 return vector of muon candidates More...
 
 ~L1MuDTWedgeSorter ()
 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 43 of file L1MuDTWedgeSorter.h.

Constructor & Destructor Documentation

◆ L1MuDTWedgeSorter()

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

constructor

Definition at line 50 of file L1MuDTWedgeSorter.cc.

References m_TrackCands.

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

◆ ~L1MuDTWedgeSorter()

L1MuDTWedgeSorter::~L1MuDTWedgeSorter ( )

destructor

Definition at line 58 of file L1MuDTWedgeSorter.cc.

58 {}

Member Function Documentation

◆ anyTrack()

bool L1MuDTWedgeSorter::anyTrack ( ) const
private

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

Definition at line 163 of file L1MuDTWedgeSorter.cc.

References m_TrackCands.

Referenced by print().

163  {
164  vector<const L1MuDTTrack*>::const_iterator iter = m_TrackCands.begin();
165  while (iter != m_TrackCands.end()) {
166  if (*iter && !(*iter)->empty())
167  return true;
168  iter++;
169  }
170 
171  return false;
172 }
std::vector< const L1MuDTTrack * > m_TrackCands

◆ id()

int L1MuDTWedgeSorter::id ( void  ) const
inline

return Wedge Sorter identifier (0-11)

Definition at line 52 of file L1MuDTWedgeSorter.h.

References m_wsid.

52 { return m_wsid; }

◆ neighbour()

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 239 of file L1MuDTWedgeSorter.cc.

References L1MuDTSecProcId::sector(), hgcalTopologyTester_cfi::sector1, hgcalTopologyTester_cfi::sector2, and L1MuDTSecProcId::wheel().

Referenced by runCOL().

239  {
240  // neighbour definition:
241  // wheel 1 : -2, -1, +1, +1, +2
242  // wheel 2 : -3, -2, -1, +2, +3
243 
244  bool neigh = false;
245 
246  int sector1 = spid1.sector();
247  int wheel1 = spid1.wheel();
248 
249  int sector2 = spid2.sector();
250  int wheel2 = spid2.wheel();
251 
252  if (sector1 == sector2) {
253  if ((wheel1 == -2 && wheel2 == -3) || (wheel1 == -1 && wheel2 == -2) || (wheel1 == +1 && wheel2 == -1) ||
254  (wheel1 == +1 && wheel2 == +2) || (wheel1 == +2 && wheel2 == +3))
255  neigh = true;
256  }
257 
258  return neigh;
259 }
int wheel() const
return wheel number
int sector() const
return sector number

◆ print()

void L1MuDTWedgeSorter::print ( void  ) const

print results after sorting

Definition at line 148 of file L1MuDTWedgeSorter.cc.

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

148  {
149  if (anyTrack()) {
150  cout << "Muon candidates found in Wedge Sorter " << m_wsid << " : " << endl;
151  vector<const L1MuDTTrack*>::const_iterator iter = m_TrackCands.begin();
152  while (iter != m_TrackCands.end()) {
153  if (*iter)
154  cout << *(*iter) << " found in " << (*iter)->spid() << endl;
155  iter++;
156  }
157  }
158 }
std::vector< const L1MuDTTrack * > m_TrackCands
bool anyTrack() const
are there any non-empty muon candidates in the Wedge Sorter?

◆ reset()

void L1MuDTWedgeSorter::reset ( void  )

reset Wedge Sorter

Definition at line 138 of file L1MuDTWedgeSorter.cc.

References m_TrackCands.

138  {
139  vector<const L1MuDTTrack*>::iterator iter;
140  for (iter = m_TrackCands.begin(); iter != m_TrackCands.end(); iter++) {
141  *iter = nullptr;
142  }
143 }
std::vector< const L1MuDTTrack * > m_TrackCands

◆ run()

void L1MuDTWedgeSorter::run ( )

run Wedge Sorter

Definition at line 67 of file L1MuDTWedgeSorter.cc.

References gather_cfg::cout, L1MuDTTFConfig::Debug(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, m_tf, m_TrackCands, m_wsid, contentValuesFiles::number, L1MuDTTrack::rank(), caHitNtupletGeneratorKernels::reject, runCOL(), nano_mu_digi_cff::sector, L1MuDTTrackFinder::sp(), L1MuDTSectorProcessor::track(), and makeMuonMisalignmentScenario::wheel.

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

◆ runCOL()

void L1MuDTWedgeSorter::runCOL ( std::vector< L1MuDTTrack *> &  cands) const
private

run the Cancel Out Logic of the wedge sorter

Definition at line 177 of file L1MuDTWedgeSorter.cc.

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

Referenced by run().

177  {
178  // compare candidates which were found in nearby wheels:
179  // if 2 candidates have at least one track segment in common
180  // disable the one with lower quality;
181  // compare addresses from stations 2, 3 and 4
182 
183  typedef vector<L1MuDTTrack*>::iterator TI;
184  for (TI iter1 = cands.begin(); iter1 != cands.end(); iter1++) {
185  if (*iter1 == nullptr)
186  continue;
187  if ((*iter1)->empty())
188  continue;
189  L1MuDTSecProcId sp1 = (*iter1)->spid();
190  int qual1 = (*iter1)->quality();
191  for (TI iter2 = cands.begin(); iter2 != cands.end(); iter2++) {
192  if (*iter2 == nullptr)
193  continue;
194  if (*iter1 == *iter2)
195  continue;
196  if ((*iter2)->empty())
197  continue;
198  L1MuDTSecProcId sp2 = (*iter2)->spid();
199  int qual2 = (*iter2)->quality();
200  if (sp1 == sp2)
201  continue;
202  if (!neighbour(sp1, sp2))
203  continue;
204  int adr_shift = (sp2.wheel() == -1) ? 0 : 2;
205  int countTS = 0;
206  for (int stat = 2; stat <= 4; stat++) {
207  int adr1 = (*iter1)->address(stat);
208  int adr2 = (*iter2)->address(stat);
209  if (adr1 == 15 || adr2 == 15)
210  continue;
211  if ((adr2 / 2) % 2 == 1)
212  continue;
213  if (adr1 == adr2 + adr_shift)
214  countTS++;
215  }
216  if (countTS > 0) {
217  if (qual1 < qual2) {
218  if (L1MuDTTFConfig::Debug(5)) {
219  cout << "Wedge Sorter cancel : ";
220  (*iter1)->print();
221  }
222  (*iter1)->disable();
223  break;
224  } else {
225  if (L1MuDTTFConfig::Debug(5)) {
226  cout << "Wedge Sorter cancel : ";
227  (*iter2)->print();
228  }
229  (*iter2)->disable();
230  }
231  }
232  }
233  }
234 }
int wheel() const
return wheel number
static bool neighbour(const L1MuDTSecProcId &spid1, const L1MuDTSecProcId &spid2)
find out if two Sector Processors are neighbours in the same wedge
static bool Debug()

◆ tracks()

const std::vector<const L1MuDTTrack*>& L1MuDTWedgeSorter::tracks ( void  ) const
inline

return vector of muon candidates

Definition at line 64 of file L1MuDTWedgeSorter.h.

References m_TrackCands.

Referenced by L1MuDTMuonSorter::run().

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

Member Data Documentation

◆ m_tf

const L1MuDTTrackFinder& L1MuDTWedgeSorter::m_tf
private

Definition at line 77 of file L1MuDTWedgeSorter.h.

Referenced by run().

◆ m_TrackCands

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

Definition at line 80 of file L1MuDTWedgeSorter.h.

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

◆ m_wsid

int L1MuDTWedgeSorter::m_wsid
private

Definition at line 78 of file L1MuDTWedgeSorter.h.

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