CMS 3D CMS Logo

L1MuBMERS.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuBMERS
4 //
5 // Description: Extrapolation Result Selector
6 //
7 //
8 //
9 // Author :
10 // N. Neumeister CERN EP
11 //
12 //--------------------------------------------------
13 
14 //-----------------------
15 // This Class's Header --
16 //-----------------------
17 
19 
20 //---------------
21 // C++ Headers --
22 //---------------
23 
24 #include <iostream>
25 #include <algorithm>
26 
27 //-------------------------------
28 // Collaborating Class Headers --
29 //-------------------------------
30 
35 
36 using namespace std;
37 
38 // --------------------------------
39 // class L1MuBMERS
40 //---------------------------------
41 
42 //----------------
43 // Constructors --
44 //----------------
45 
46 L1MuBMERS::L1MuBMERS(const L1MuBMSEU& seu) : m_seu(seu) { reset(); }
47 
48 //--------------
49 // Destructor --
50 //--------------
51 
53 
54 //--------------
55 // Operations --
56 //--------------
57 
58 //
59 // run ERS
60 //
62  int n_ext = m_seu.numberOfExt();
63  if (n_ext > 0) {
64  vector<L1MuBMEUX*>::const_iterator first = m_seu.eux().begin();
65  vector<L1MuBMEUX*>::const_iterator last = m_seu.eux().end();
66  vector<L1MuBMEUX*>::const_iterator first_max;
67  vector<L1MuBMEUX*>::const_iterator second_max;
68 
69  // find the best extrapolation
70  first_max = max_element(first, last, L1MuBMEUX::EUX_Comp());
71  m_address[0] = (*first_max)->address();
72  m_quality[0] = (*first_max)->quality();
73  m_start[0] = (*first_max)->ts().first;
74  m_target[0] = (*first_max)->ts().second;
75 
76  if (n_ext > 1) {
77  // find the second best extrapolation
78  second_max = max_element(first, last, L1MuBMEUX::EUX_Comp(*first_max));
79  m_address[1] = (*second_max)->address();
80  m_quality[1] = (*second_max)->quality();
81  m_start[1] = (*second_max)->ts().first;
82  m_target[1] = (*second_max)->ts().second;
83  }
84 
85  if (L1MuBMTFConfig::Debug(4)) {
86  cout << "ERS : " << endl;
87  cout << "\t first : " << m_address[0] << '\t' << m_quality[0] << endl;
88  cout << "\t second : " << m_address[1] << '\t' << m_quality[1] << endl;
89  }
90  }
91 }
92 
93 //
94 // reset ERS
95 //
97  for (int id = 0; id < 2; id++) {
98  m_quality[id] = 0;
99  m_address[id] = 15;
100  m_start[id] = nullptr;
101  m_target[id] = nullptr;
102  }
103 }
104 
105 //
106 // return pointer to start and target track segment
107 //
108 pair<const L1MuBMTrackSegPhi*, const L1MuBMTrackSegPhi*> L1MuBMERS::ts(int id) const {
109  return pair<const L1MuBMTrackSegPhi*, const L1MuBMTrackSegPhi*>(m_start[id], m_target[id]);
110 }
~L1MuBMERS() override
destructor
Definition: L1MuBMERS.cc:52
void reset() override
reset ERS
Definition: L1MuBMERS.cc:96
int numberOfExt() const
return number of successful extrapolations
Definition: L1MuBMSEU.cc:173
unsigned short int m_quality[2]
Definition: L1MuBMERS.h:69
void run() override
run L1MuBMERS
Definition: L1MuBMERS.cc:61
const std::vector< L1MuBMEUX * > & eux() const
return pointer to an Extrapolator
Definition: L1MuBMSEU.h:90
const L1MuBMTrackSegPhi * m_target[2]
Definition: L1MuBMERS.h:73
const L1MuBMSEU & m_seu
Definition: L1MuBMERS.h:67
L1MuBMERS(const L1MuBMSEU &)
constructor
Definition: L1MuBMERS.cc:46
static bool Debug()
helper class for finding the best and second best extrapolation
Definition: L1MuBMEUX.h:76
const L1MuBMTrackSegPhi * m_start[2]
Definition: L1MuBMERS.h:72
std::pair< const L1MuBMTrackSegPhi *, const L1MuBMTrackSegPhi * > ts(int id) const
return pointer to start and target track segment
Definition: L1MuBMERS.cc:108
unsigned short int m_address[2]
Definition: L1MuBMERS.h:70