Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:50

0001 //-------------------------------------------------
0002 //
0003 //   Class: L1MuBMERS
0004 //
0005 //   Description: Extrapolation Result Selector
0006 //
0007 //
0008 //
0009 //   Author :
0010 //   N. Neumeister            CERN EP
0011 //
0012 //--------------------------------------------------
0013 
0014 //-----------------------
0015 // This Class's Header --
0016 //-----------------------
0017 
0018 #include "L1Trigger/L1TMuonBarrel/src/L1MuBMERS.h"
0019 
0020 //---------------
0021 // C++ Headers --
0022 //---------------
0023 
0024 #include <iostream>
0025 #include <algorithm>
0026 
0027 //-------------------------------
0028 // Collaborating Class Headers --
0029 //-------------------------------
0030 
0031 #include "L1Trigger/L1TMuonBarrel/src/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 //       class L1MuBMERS
0040 //---------------------------------
0041 
0042 //----------------
0043 // Constructors --
0044 //----------------
0045 
0046 L1MuBMERS::L1MuBMERS(const L1MuBMSEU& seu) : m_seu(seu) { reset(); }
0047 
0048 //--------------
0049 // Destructor --
0050 //--------------
0051 
0052 L1MuBMERS::~L1MuBMERS() {}
0053 
0054 //--------------
0055 // Operations --
0056 //--------------
0057 
0058 //
0059 // run ERS
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     // find the best extrapolation
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       // find the second best extrapolation
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 (L1MuBMTFConfig::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 // reset ERS
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 // return pointer to start and target track segment
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 }