CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuDTERS.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTERS
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 L1MuDTERS
40 //---------------------------------
41 
42 //----------------
43 // Constructors --
44 //----------------
45 
46 L1MuDTERS::L1MuDTERS(const L1MuDTSEU& seu) : m_seu(seu) {
47 
48  reset();
49 
50 }
51 
52 
53 //--------------
54 // Destructor --
55 //--------------
56 
58 
59 
60 //--------------
61 // Operations --
62 //--------------
63 
64 //
65 // run ERS
66 //
68 
69  int n_ext = m_seu.numberOfExt();
70  if ( n_ext > 0 ) {
71  vector<L1MuDTEUX*>::const_iterator first = m_seu.eux().begin();
72  vector<L1MuDTEUX*>::const_iterator last = m_seu.eux().end();
73  vector<L1MuDTEUX*>::const_iterator first_max;
74  vector<L1MuDTEUX*>::const_iterator second_max;
75 
76  // find the best extrapolation
77  first_max = max_element(first, last, L1MuDTEUX::EUX_Comp() );
78  m_address[0] = (*first_max)->address();
79  m_quality[0] = (*first_max)->quality();
80  m_start[0] = (*first_max)->ts().first;
81  m_target[0] = (*first_max)->ts().second;
82 
83 
84  if ( n_ext > 1 ) {
85  // find the second best extrapolation
86  second_max = max_element(first, last, L1MuDTEUX::EUX_Comp(*first_max) );
87  m_address[1] = (*second_max)->address();
88  m_quality[1] = (*second_max)->quality();
89  m_start[1] = (*second_max)->ts().first;
90  m_target[1] = (*second_max)->ts().second;
91  }
92 
93  if ( L1MuDTTFConfig::Debug(4) ) {
94  cout << "ERS : " << endl;
95  cout << "\t first : " << m_address[0] << '\t' << m_quality[0] << endl;
96  cout << "\t second : " << m_address[1] << '\t' << m_quality[1] << endl;
97  }
98 
99  }
100 
101 }
102 
103 
104 //
105 // reset ERS
106 //
108 
109  for ( int id = 0; id < 2; id++ ) {
110  m_quality[id] = 0;
111  m_address[id] = 15;
112  m_start[id] = 0;
113  m_target[id] = 0;
114  }
115 
116 }
117 
118 
119 //
120 // return pointer to start and target track segment
121 //
122 pair<const L1MuDTTrackSegPhi*, const L1MuDTTrackSegPhi*> L1MuDTERS::ts(int id) const {
123 
124  return pair<const L1MuDTTrackSegPhi*,const L1MuDTTrackSegPhi*>(m_start[id],m_target[id]);
125 
126 }
virtual ~L1MuDTERS()
destructor
Definition: L1MuDTERS.cc:57
virtual void reset()
reset ERS
Definition: L1MuDTERS.cc:107
L1MuDTERS(const L1MuDTSEU &)
constructor
Definition: L1MuDTERS.cc:46
const L1MuDTTrackSegPhi * m_start[2]
Definition: L1MuDTERS.h:75
unsigned short int m_address[2]
Definition: L1MuDTERS.h:73
static bool Debug()
helper class for finding the best and second best extrapolation
Definition: L1MuDTEUX.h:74
virtual void run()
run L1MuDTERS
Definition: L1MuDTERS.cc:67
const L1MuDTTrackSegPhi * m_target[2]
Definition: L1MuDTERS.h:76
const L1MuDTSEU & m_seu
Definition: L1MuDTERS.h:70
unsigned short int m_quality[2]
Definition: L1MuDTERS.h:72
int numberOfExt() const
return number of successful extrapolations
Definition: L1MuDTSEU.cc:187
tuple cout
Definition: gather_cfg.py:121
const std::vector< L1MuDTEUX * > & eux() const
return pointer to an Extrapolator
Definition: L1MuDTSEU.h:92
std::pair< const L1MuDTTrackSegPhi *, const L1MuDTTrackSegPhi * > ts(int id) const
return pointer to start and target track segment
Definition: L1MuDTERS.cc:122