CMS 3D CMS Logo

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

#include <L1MuBMWedgeSorter.h>

Inheritance diagram for L1MuBMWedgeSorter:
L1AbstractProcessor

Public Member Functions

bool anyMuonCands () const
 return number of muon candidates More...
 
int id () const
 return Wedge Sorter identifier (0-11) More...
 
 L1MuBMWedgeSorter (const L1MuBMTrackFinder &, 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 L1MuBMTrack * > & tracks () const
 return vector of muon candidates More...
 
 ~L1MuBMWedgeSorter () 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< L1MuBMTrack * > &) const
 run the Cancel Out Logic of the wedge sorter More...
 

Static Private Member Functions

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

Private Attributes

const L1MuBMTrackFinderm_tf
 
std::vector< const L1MuBMTrack * > 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 BM Muon Sorter

N. Neumeister CERN EP

Definition at line 45 of file L1MuBMWedgeSorter.h.

Constructor & Destructor Documentation

◆ L1MuBMWedgeSorter()

L1MuBMWedgeSorter::L1MuBMWedgeSorter ( const L1MuBMTrackFinder tf,
int  id 
)

constructor

Definition at line 50 of file L1MuBMWedgeSorter.cc.

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

References m_TrackCands.

◆ ~L1MuBMWedgeSorter()

L1MuBMWedgeSorter::~L1MuBMWedgeSorter ( )
override

destructor

Definition at line 58 of file L1MuBMWedgeSorter.cc.

58 {}

Member Function Documentation

◆ anyMuonCands()

bool L1MuBMWedgeSorter::anyMuonCands ( ) const
inline

return number of muon candidates

Definition at line 69 of file L1MuBMWedgeSorter.h.

69 { return anyTrack(); }

References anyTrack().

◆ anyTrack()

bool L1MuBMWedgeSorter::anyTrack ( ) const
private

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

Definition at line 163 of file L1MuBMWedgeSorter.cc.

163  {
164  vector<const L1MuBMTrack*>::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 anyMuonCands(), and print().

◆ id()

int L1MuBMWedgeSorter::id ( void  ) const
inline

return Wedge Sorter identifier (0-11)

Definition at line 54 of file L1MuBMWedgeSorter.h.

54 { return m_wsid; }

References m_wsid.

◆ neighbour()

bool L1MuBMWedgeSorter::neighbour ( const L1MuBMSecProcId spid1,
const L1MuBMSecProcId spid2 
)
staticprivate

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

Definition at line 239 of file L1MuBMWedgeSorter.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 L1MuBMSecProcId::sector(), hgcalTopologyTester_cfi::sector1, hgcalTopologyTester_cfi::sector2, and L1MuBMSecProcId::wheel().

Referenced by runCOL().

◆ print()

void L1MuBMWedgeSorter::print ( void  ) const

print results after sorting

Definition at line 148 of file L1MuBMWedgeSorter.cc.

148  {
149  if (anyTrack()) {
150  cout << "Muon candidates found in Wedge Sorter " << m_wsid << " : " << endl;
151  vector<const L1MuBMTrack*>::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 L1MuBMWedgeSorter::reset ( void  )
overridevirtual

reset Wedge Sorter

Implements L1AbstractProcessor.

Definition at line 138 of file L1MuBMWedgeSorter.cc.

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

References m_TrackCands.

◆ run()

void L1MuBMWedgeSorter::run ( )
overridevirtual

run Wedge Sorter

Reimplemented from L1AbstractProcessor.

Definition at line 67 of file L1MuBMWedgeSorter.cc.

67  {
68  // get track candidates from Sector Processors
69  vector<L1MuBMTrack*> 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  L1MuBMSecProcId tmpspid(wheel, sector);
77  for (int number = 0; number < 2; number++) {
78  const L1MuBMTrack* 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<L1MuBMTrack*>(cand));
94  }
95  }
96  }
97 
98  // print input data
99  if (L1MuBMTFConfig::Debug(5)) {
100  cout << "Wedge Sorter " << m_wsid << " input: " << wedgecands.size() << endl;
101  vector<L1MuBMTrack*>::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<L1MuBMTrack*>::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(), L1MuBMTrack::rank);
124 
125  if (L1MuBMTFConfig::Debug(4)) {
126  cout << "Wedge Sorter " << m_wsid << " output: " << endl;
127  vector<const L1MuBMTrack*>::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, L1MuBMTFConfig::Debug(), m_tf, m_TrackCands, m_wsid, contentValuesFiles::number, L1MuBMTrack::rank(), reject, runCOL(), L1MuBMTrackFinder::sp(), edm_modernize_messagelogger::stat, L1MuBMSectorProcessor::track(), and makeMuonMisalignmentScenario::wheel.

◆ runCOL()

void L1MuBMWedgeSorter::runCOL ( std::vector< L1MuBMTrack * > &  cands) const
private

run the Cancel Out Logic of the wedge sorter

Definition at line 177 of file L1MuBMWedgeSorter.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<L1MuBMTrack*>::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  L1MuBMSecProcId 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  L1MuBMSecProcId 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 (L1MuBMTFConfig::Debug(5)) {
219  cout << "Wedge Sorter cancel : ";
220  (*iter1)->print();
221  }
222  (*iter1)->disable();
223  break;
224  } else {
225  if (L1MuBMTFConfig::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, L1MuBMTFConfig::Debug(), neighbour(), edm_modernize_messagelogger::stat, and L1MuBMSecProcId::wheel().

Referenced by run().

◆ tracks()

const std::vector<const L1MuBMTrack*>& L1MuBMWedgeSorter::tracks ( void  ) const
inline

return vector of muon candidates

Definition at line 66 of file L1MuBMWedgeSorter.h.

66 { return m_TrackCands; }

References m_TrackCands.

Referenced by L1MuBMMuonSorter::run().

Member Data Documentation

◆ m_tf

const L1MuBMTrackFinder& L1MuBMWedgeSorter::m_tf
private

Definition at line 82 of file L1MuBMWedgeSorter.h.

Referenced by run().

◆ m_TrackCands

std::vector<const L1MuBMTrack*> L1MuBMWedgeSorter::m_TrackCands
private

Definition at line 85 of file L1MuBMWedgeSorter.h.

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

◆ m_wsid

int L1MuBMWedgeSorter::m_wsid
private

Definition at line 83 of file L1MuBMWedgeSorter.h.

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

L1MuBMSecProcId
Definition: L1MuBMSecProcId.h:40
hgcalTopologyTester_cfi.sector1
sector1
Definition: hgcalTopologyTester_cfi.py:9
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1MuBMWedgeSorter::m_wsid
int m_wsid
Definition: L1MuBMWedgeSorter.h:83
L1MuBMWedgeSorter::anyTrack
bool anyTrack() const
are there any non-empty muon candidates in the Wedge Sorter?
Definition: L1MuBMWedgeSorter.cc:163
L1MuBMSecProcId::sector
int sector() const
return sector number
Definition: L1MuBMSecProcId.h:58
L1MuBMSecProcId::wheel
int wheel() const
return wheel number
Definition: L1MuBMSecProcId.h:55
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
L1MuBMTFConfig::Debug
static bool Debug()
Definition: L1MuBMTFConfig.h:52
L1MuBMWedgeSorter::neighbour
static bool neighbour(const L1MuBMSecProcId &spid1, const L1MuBMSecProcId &spid2)
find out if two Sector Processors are neighbours in the same wedge
Definition: L1MuBMWedgeSorter.cc:239
HLT_FULL_cff.cands
cands
Definition: HLT_FULL_cff.py:15161
L1MuBMWedgeSorter::m_tf
const L1MuBMTrackFinder & m_tf
Definition: L1MuBMWedgeSorter.h:82
cand
Definition: decayParser.h:32
L1MuBMTrack
Definition: L1MuBMTrack.h:49
L1MuBMWedgeSorter::runCOL
void runCOL(std::vector< L1MuBMTrack * > &) const
run the Cancel Out Logic of the wedge sorter
Definition: L1MuBMWedgeSorter.cc:177
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
L1MuBMTrack::rank
static bool rank(const L1MuBMTrack *first, const L1MuBMTrack *second)
define a rank for muon candidates
Definition: L1MuBMTrack.h:190
L1MuBMSectorProcessor::track
L1MuBMTrack * track(int id) const
return pointer to muon candidate, index [0,1]
Definition: L1MuBMSectorProcessor.h:100
hgcalTopologyTester_cfi.sector2
sector2
Definition: hgcalTopologyTester_cfi.py:10
reject
const auto reject
Definition: CAHitNtupletGeneratorKernelsImpl.h:619
edm_modernize_messagelogger.stat
stat
Definition: edm_modernize_messagelogger.py:27
L1MuBMTrackFinder::sp
const L1MuBMSectorProcessor * sp(const L1MuBMSecProcId &) const
get a pointer to a Sector Processor
Definition: L1MuBMTrackFinder.cc:409
L1MuBMWedgeSorter::m_TrackCands
std::vector< const L1MuBMTrack * > m_TrackCands
Definition: L1MuBMWedgeSorter.h:85