File indexing completed on 2024-11-15 23:40:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include "L1Trigger/L1TMuonBarrel/src/L1MuBMERS.h"
0019
0020
0021
0022
0023
0024 #include <iostream>
0025 #include <algorithm>
0026
0027
0028
0029
0030
0031 #include "L1Trigger/L1TMuonBarrel/interface/L1MuBMTFConfig.h"
0032 #include "DataFormats/L1TMuon/interface/L1MuBMTrackSegPhi.h"
0033 #include "L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.h"
0034 #include "L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.h"
0035
0036 using namespace std;
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 L1MuBMERS::L1MuBMERS(const L1MuBMSEU& seu) : m_seu(seu) { reset(); }
0047
0048
0049
0050
0051
0052 L1MuBMERS::~L1MuBMERS() {}
0053
0054
0055
0056
0057
0058
0059
0060
0061 void L1MuBMERS::run() {
0062 int n_ext = m_seu.numberOfExt();
0063 if (n_ext > 0) {
0064 vector<L1MuBMEUX*>::const_iterator first = m_seu.eux().begin();
0065 vector<L1MuBMEUX*>::const_iterator last = m_seu.eux().end();
0066 vector<L1MuBMEUX*>::const_iterator first_max;
0067 vector<L1MuBMEUX*>::const_iterator second_max;
0068
0069
0070 first_max = max_element(first, last, L1MuBMEUX::EUX_Comp());
0071 m_address[0] = (*first_max)->address();
0072 m_quality[0] = (*first_max)->quality();
0073 m_start[0] = (*first_max)->ts().first;
0074 m_target[0] = (*first_max)->ts().second;
0075
0076 if (n_ext > 1) {
0077
0078 second_max = max_element(first, last, L1MuBMEUX::EUX_Comp(*first_max));
0079 m_address[1] = (*second_max)->address();
0080 m_quality[1] = (*second_max)->quality();
0081 m_start[1] = (*second_max)->ts().first;
0082 m_target[1] = (*second_max)->ts().second;
0083 }
0084
0085 if (m_seu.config().Debug(4)) {
0086 cout << "ERS : " << endl;
0087 cout << "\t first : " << m_address[0] << '\t' << m_quality[0] << endl;
0088 cout << "\t second : " << m_address[1] << '\t' << m_quality[1] << endl;
0089 }
0090 }
0091 }
0092
0093
0094
0095
0096 void L1MuBMERS::reset() {
0097 for (int id = 0; id < 2; id++) {
0098 m_quality[id] = 0;
0099 m_address[id] = 15;
0100 m_start[id] = nullptr;
0101 m_target[id] = nullptr;
0102 }
0103 }
0104
0105
0106
0107
0108 pair<const L1MuBMTrackSegPhi*, const L1MuBMTrackSegPhi*> L1MuBMERS::ts(int id) const {
0109 return pair<const L1MuBMTrackSegPhi*, const L1MuBMTrackSegPhi*>(m_start[id], m_target[id]);
0110 }