Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-28 23:48:40

0001 //-------------------------------------------------
0002 //
0003 //   Class: L1MuDTSEU
0004 //
0005 //   Description: Single Extrapolation Unit
0006 //
0007 //
0008 //
0009 //   Author :
0010 //   N. Neumeister            CERN EP
0011 //
0012 //--------------------------------------------------
0013 
0014 //-----------------------
0015 // This Class's Header --
0016 //-----------------------
0017 
0018 #include "L1Trigger/DTTrackFinder/src/L1MuDTSEU.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/DTTrackFinder/interface/L1MuDTTFConfig.h"
0032 #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h"
0033 #include "L1Trigger/DTTrackFinder/src/L1MuDTDataBuffer.h"
0034 #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegLoc.h"
0035 #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h"
0036 #include "L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h"
0037 #include "L1Trigger/DTTrackFinder/src/L1MuDTEUX.h"
0038 #include "L1Trigger/DTTrackFinder/src/L1MuDTERS.h"
0039 
0040 using namespace std;
0041 
0042 // --------------------------------
0043 //       class L1MuDTSEU
0044 //---------------------------------
0045 
0046 //----------------
0047 // Constructors --
0048 //----------------
0049 
0050 L1MuDTSEU::L1MuDTSEU(const L1MuDTSectorProcessor& sp, Extrapolation ext, unsigned int tsId)
0051     : m_sp(sp), m_ext(ext), m_startTS_Id(tsId), m_startTS(nullptr), m_EUXs(), m_ERS() {
0052   m_EUXs.reserve(12);
0053 
0054   for (int target_ts = 0; target_ts < 12; target_ts++) {
0055     m_EUXs.push_back(new L1MuDTEUX(m_sp, *this, target_ts));
0056   }
0057 
0058   m_ERS = new L1MuDTERS(*this);
0059 }
0060 
0061 //--------------
0062 // Destructor --
0063 //--------------
0064 
0065 L1MuDTSEU::~L1MuDTSEU() {
0066   vector<L1MuDTEUX*>::iterator iter_eux;
0067   for (iter_eux = m_EUXs.begin(); iter_eux != m_EUXs.end(); iter_eux++) {
0068     delete (*iter_eux);
0069     *iter_eux = nullptr;
0070   }
0071 
0072   m_startTS = nullptr;
0073   m_EUXs.clear();
0074 
0075   delete m_ERS;
0076 }
0077 
0078 //--------------
0079 // Operations --
0080 //--------------
0081 
0082 //
0083 // run SEU
0084 //
0085 void L1MuDTSEU::run(const L1MuDTExtLut& extLUTs, const L1MuDTTFParameters& pars) {
0086   if (L1MuDTTFConfig::Debug(3))
0087     cout << "Run SEU " << m_ext << " " << m_startTS_Id << endl;
0088 
0089   pair<int, int> ext_pair = L1MuDTExtrapolationUnit::which_ext(m_ext);
0090   int target = ext_pair.second;
0091 
0092   // check if it is a nextWheel or ownWheel SEU
0093   bool nextWheel = isNextWheelSEU();
0094 
0095   // relative addresses used
0096   //                                         nextWheel
0097   //           extrapolation               extrapolation
0098   //              address                    address
0099   //        +--------+--------+         +--------+--------+
0100   //    +   |        |        |     +   |        |        |
0101   //        |  4   5 |  6   7 |         |        |  6   7 |
0102   //    |   |        |        |     |   |        |        |
0103   //    |   +--------+--------+     |   +--------+--------+
0104   //        |........|        |         |........|        |
0105   //   phi  |..0...1.|  2   3 |    phi  |........|  2   3 |
0106   //        |........|        |         |........|        |
0107   //    |   +--------+--------+     |   +--------+--------+
0108   //    |   |        |        |     |   |        |        |
0109   //        |  8   9 | 10  11 |         |        | 10  11 |
0110   //    -   |        |        |     -   |        |        |
0111   //        +--------+--------+         +--------+--------+
0112   //
0113   //             -- eta --                   -- eta --
0114 
0115   // loop over all 12 target addresses
0116   for (int reladr = 0; reladr < 12; reladr++) {
0117     // for the nextWheel extrapolations only reladr: 2,3,6,7,10,11
0118     if (nextWheel && (reladr / 2) % 2 == 0)
0119       continue;
0120 
0121     const L1MuDTTrackSegPhi* target_ts = m_sp.data()->getTSphi(target, reladr);
0122     if (target_ts && !target_ts->empty()) {
0123       m_EUXs[reladr]->load(m_startTS, target_ts);
0124       m_EUXs[reladr]->run(extLUTs, pars);
0125       if (m_EUXs[reladr]->result())
0126         m_EXtable.set(reladr);
0127     }
0128   }
0129 
0130   if (L1MuDTTFConfig::Debug(3)) {
0131     int n_ext = numberOfExt();
0132     if (n_ext > 0)
0133       cout << "number of successful EUX : " << n_ext << endl;
0134   }
0135 
0136   if (m_ERS)
0137     m_ERS->run();
0138 
0139   //  if ( m_ERS->address(0) != 15 ) m_QStable.set(m_ERS->address(0));
0140   //  if ( m_ERS->address(1) != 15 ) m_QStable.set(m_ERS->address(1));
0141   m_QStable = m_EXtable;
0142 }
0143 
0144 //
0145 // reset SEU
0146 //
0147 void L1MuDTSEU::reset() {
0148   m_startTS = nullptr;
0149   vector<L1MuDTEUX*>::iterator iter_eux;
0150   for (iter_eux = m_EUXs.begin(); iter_eux != m_EUXs.end(); iter_eux++) {
0151     (*iter_eux)->reset();
0152   }
0153 
0154   m_ERS->reset();
0155 
0156   m_EXtable.reset();
0157   m_QStable.reset();
0158 }
0159 
0160 //
0161 // reset a single extrapolation
0162 //
0163 void L1MuDTSEU::reset(unsigned int relAdr) {
0164   m_EXtable.reset(relAdr);
0165   m_QStable.reset(relAdr);
0166   m_EUXs[relAdr]->reset();
0167   //  m_ERS->reset();
0168 }
0169 
0170 //
0171 // get number of successful extrapolations
0172 //
0173 int L1MuDTSEU::numberOfExt() const {
0174   int number = 0;
0175   vector<L1MuDTEUX*>::const_iterator iter_eux;
0176   for (iter_eux = m_EUXs.begin(); iter_eux != m_EUXs.end(); iter_eux++) {
0177     if ((*iter_eux)->result())
0178       number++;
0179   }
0180 
0181   return number;
0182 }