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>

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...
 
void reset () override
 reset Wedge Sorter More...
 
void run () override
 run Wedge Sorter More...
 
const std::vector< const L1MuDTTrack * > & tracks () const
 return vector of muon candidates More...
 
 ~L1MuDTWedgeSorter () override
 destructor More...
 
- Public Member Functions inherited from L1AbstractProcessor
virtual void run (const edm::EventSetup &c)
 
virtual void run (const edm::EventSetup &c)
 
virtual ~L1AbstractProcessor ()
 destructor More...
 
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::L1MuDTWedgeSorter ( const L1MuDTTrackFinder tf,
int  id 
)

constructor

Definition at line 50 of file L1MuDTWedgeSorter.cc.

50  : m_tf(tf), m_wsid(id), m_TrackCands(2) {
51  m_TrackCands.reserve(2);
52 }

References m_TrackCands.

◆ ~L1MuDTWedgeSorter()

L1MuDTWedgeSorter::~L1MuDTWedgeSorter ( )
override

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.

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 }

References m_TrackCands.

Referenced by print().

◆ id()

int L1MuDTWedgeSorter::id ( void  ) const
inline

return Wedge Sorter identifier (0-11)

Definition at line 54 of file L1MuDTWedgeSorter.h.

54 { return m_wsid; }

References 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.

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 }

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

Referenced by runCOL().

◆ print()

void L1MuDTWedgeSorter::print ( void  ) const

print results after sorting

Definition at line 148 of file L1MuDTWedgeSorter.cc.

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 }

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

◆ reset()

void L1MuDTWedgeSorter::reset ( void  )
overridevirtual

reset Wedge Sorter

Implements L1AbstractProcessor.

Definition at line 138 of file L1MuDTWedgeSorter.cc.

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

References m_TrackCands.

◆ run()

void L1MuDTWedgeSorter::run ( )
overridevirtual

run Wedge Sorter

Reimplemented from L1AbstractProcessor.

Definition at line 67 of file L1MuDTWedgeSorter.cc.

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 }

References gather_cfg::cout, L1MuDTTFConfig::Debug(), m_tf, m_TrackCands, m_wsid, contentValuesFiles::number, L1MuDTTrack::rank(), runCOL(), L1MuDTTrackFinder::sp(), hgcalPlots::stat, L1MuDTSectorProcessor::track(), and makeMuonMisalignmentScenario::wheel.

◆ 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.

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 }

References HLT_FULL_cff::cands, gather_cfg::cout, L1MuDTTFConfig::Debug(), neighbour(), hgcalPlots::stat, and L1MuDTSecProcId::wheel().

Referenced by run().

◆ tracks()

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

return vector of muon candidates

Definition at line 66 of file L1MuDTWedgeSorter.h.

66 { return m_TrackCands; }

References m_TrackCands.

Referenced by L1MuDTMuonSorter::run().

Member Data Documentation

◆ m_tf

const L1MuDTTrackFinder& L1MuDTWedgeSorter::m_tf
private

Definition at line 79 of file L1MuDTWedgeSorter.h.

Referenced by run().

◆ m_TrackCands

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

Definition at line 82 of file L1MuDTWedgeSorter.h.

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

◆ m_wsid

int L1MuDTWedgeSorter::m_wsid
private

Definition at line 80 of file L1MuDTWedgeSorter.h.

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

L1MuDTWedgeSorter::neighbour
static bool neighbour(const L1MuDTSecProcId &spid1, const L1MuDTSecProcId &spid2)
find out if two Sector Processors are neighbours in the same wedge
Definition: L1MuDTWedgeSorter.cc:239
L1MuDTWedgeSorter::anyTrack
bool anyTrack() const
are there any non-empty muon candidates in the Wedge Sorter?
Definition: L1MuDTWedgeSorter.cc:163
L1MuDTWedgeSorter::m_TrackCands
std::vector< const L1MuDTTrack * > m_TrackCands
Definition: L1MuDTWedgeSorter.h:82
hgcalTopologyTester_cfi.sector1
sector1
Definition: hgcalTopologyTester_cfi.py:9
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1MuDTWedgeSorter::runCOL
void runCOL(std::vector< L1MuDTTrack * > &) const
run the Cancel Out Logic of the wedge sorter
Definition: L1MuDTWedgeSorter.cc:177
L1MuDTSectorProcessor::track
L1MuDTTrack * track(int id) const
return pointer to muon candidate, index [0,1]
Definition: L1MuDTSectorProcessor.h:99
L1MuDTTrack::rank
static bool rank(const L1MuDTTrack *first, const L1MuDTTrack *second)
define a rank for muon candidates
Definition: L1MuDTTrack.h:185
hgcalPlots.stat
stat
Definition: hgcalPlots.py:1119
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
L1MuDTSecProcId::wheel
int wheel() const
return wheel number
Definition: L1MuDTSecProcId.h:55
L1MuDTTrackFinder::sp
const L1MuDTSectorProcessor * sp(const L1MuDTSecProcId &) const
get a pointer to a Sector Processor
Definition: L1MuDTTrackFinder.cc:294
HLT_FULL_cff.cands
cands
Definition: HLT_FULL_cff.py:15208
L1MuDTSecProcId::sector
int sector() const
return sector number
Definition: L1MuDTSecProcId.h:58
L1MuDTSecProcId
Definition: L1MuDTSecProcId.h:40
L1MuDTWedgeSorter::m_wsid
int m_wsid
Definition: L1MuDTWedgeSorter.h:80
cand
Definition: decayParser.h:32
L1MuDTTrack
Definition: L1MuDTTrack.h:47
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
hgcalTopologyTester_cfi.sector2
sector2
Definition: hgcalTopologyTester_cfi.py:10
L1MuDTTFConfig::Debug
static bool Debug()
Definition: L1MuDTTFConfig.h:49
L1MuDTWedgeSorter::m_tf
const L1MuDTTrackFinder & m_tf
Definition: L1MuDTWedgeSorter.h:79