CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/L1Trigger/DTTrackFinder/src/L1MuDTSEU.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: L1MuDTSEU
00004 //
00005 //   Description: Single Extrapolation Unit
00006 //
00007 //
00008 //   $Date: 2008/11/28 10:30:51 $
00009 //   $Revision: 1.4 $
00010 //
00011 //   Author :
00012 //   N. Neumeister            CERN EP
00013 //
00014 //--------------------------------------------------
00015 
00016 //-----------------------
00017 // This Class's Header --
00018 //-----------------------
00019 
00020 #include "L1Trigger/DTTrackFinder/src/L1MuDTSEU.h"
00021 
00022 //---------------
00023 // C++ Headers --
00024 //---------------
00025 
00026 #include <iostream>
00027 #include <algorithm>
00028 
00029 //-------------------------------
00030 // Collaborating Class Headers --
00031 //-------------------------------
00032 
00033 #include "L1Trigger/DTTrackFinder/src/L1MuDTTFConfig.h"
00034 #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h"
00035 #include "L1Trigger/DTTrackFinder/src/L1MuDTDataBuffer.h"
00036 #include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.h"
00037 #include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h"
00038 #include "L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h"
00039 #include "L1Trigger/DTTrackFinder/src/L1MuDTEUX.h"
00040 #include "L1Trigger/DTTrackFinder/src/L1MuDTERS.h"
00041 
00042 using namespace std;
00043 
00044 // --------------------------------
00045 //       class L1MuDTSEU
00046 //---------------------------------
00047 
00048 //----------------
00049 // Constructors --
00050 //----------------
00051 
00052 L1MuDTSEU::L1MuDTSEU(const L1MuDTSectorProcessor& sp, Extrapolation ext, unsigned int tsId) : 
00053      m_sp(sp), m_ext(ext), 
00054      m_startTS_Id(tsId), m_startTS(0), m_EUXs(), m_ERS() {
00055  
00056   m_EUXs.reserve(12);
00057 
00058   for ( int target_ts = 0; target_ts < 12; target_ts++ ) {
00059     m_EUXs.push_back( new L1MuDTEUX(m_sp,*this,target_ts) );
00060   }
00061 
00062   m_ERS = new L1MuDTERS(*this);
00063 
00064 }
00065 
00066 
00067 //--------------
00068 // Destructor --
00069 //--------------
00070 
00071 L1MuDTSEU::~L1MuDTSEU() {
00072 
00073   vector<L1MuDTEUX*>::iterator iter_eux;
00074   for ( iter_eux = m_EUXs.begin(); iter_eux != m_EUXs.end(); iter_eux++ ) {
00075     delete (*iter_eux);
00076     *iter_eux = 0;
00077   }
00078 
00079   m_startTS = 0;
00080   m_EUXs.clear();
00081 
00082   delete m_ERS;
00083 
00084 }
00085 
00086 
00087 //--------------
00088 // Operations --
00089 //--------------
00090 
00091 //
00092 // run SEU
00093 //
00094 void L1MuDTSEU::run(const edm::EventSetup& c) {
00095 
00096   if ( L1MuDTTFConfig::Debug(3) ) cout << "Run SEU " << m_ext << " " 
00097                                        << m_startTS_Id << endl;
00098 
00099   pair<int,int> ext_pair = L1MuDTExtrapolationUnit::which_ext(m_ext);
00100   int target = ext_pair.second;
00101 
00102   // check if it is a nextWheel or ownWheel SEU
00103   bool nextWheel = isNextWheelSEU();
00104 
00105   // relative addresses used
00106   //                                         nextWheel
00107   //           extrapolation               extrapolation
00108   //              address                    address
00109   //        +--------+--------+         +--------+--------+
00110   //    +   |        |        |     +   |        |        |
00111   //        |  4   5 |  6   7 |         |        |  6   7 |
00112   //    |   |        |        |     |   |        |        |
00113   //    |   +--------+--------+     |   +--------+--------+
00114   //        |........|        |         |........|        |
00115   //   phi  |..0...1.|  2   3 |    phi  |........|  2   3 |
00116   //        |........|        |         |........|        |
00117   //    |   +--------+--------+     |   +--------+--------+
00118   //    |   |        |        |     |   |        |        |
00119   //        |  8   9 | 10  11 |         |        | 10  11 |
00120   //    -   |        |        |     -   |        |        |
00121   //        +--------+--------+         +--------+--------+
00122   //
00123   //             -- eta --                   -- eta --  
00124 
00125   // loop over all 12 target addresses
00126   for ( int reladr = 0; reladr < 12; reladr++ ) {
00127 
00128     // for the nextWheel extrapolations only reladr: 2,3,6,7,10,11 
00129     if ( nextWheel && (reladr/2)%2 == 0 ) continue;
00130 
00131     const L1MuDTTrackSegPhi* target_ts = m_sp.data()->getTSphi(target, reladr);
00132     if ( target_ts && !target_ts->empty() ) {
00133       m_EUXs[reladr]->load(m_startTS, target_ts);
00134       m_EUXs[reladr]->run(c);
00135       if ( m_EUXs[reladr]->result() ) m_EXtable.set(reladr);
00136     }
00137 
00138   }
00139 
00140   if ( L1MuDTTFConfig::Debug(3) ) {
00141     int n_ext = numberOfExt();
00142     if ( n_ext > 0 ) cout << "number of successful EUX : " <<  n_ext << endl;
00143   }
00144 
00145   if ( m_ERS ) m_ERS->run();
00146 
00147   //  if ( m_ERS->address(0) != 15 ) m_QStable.set(m_ERS->address(0));
00148   //  if ( m_ERS->address(1) != 15 ) m_QStable.set(m_ERS->address(1));
00149   m_QStable = m_EXtable;
00150 
00151 }
00152 
00153 
00154 //
00155 // reset SEU
00156 //
00157 void L1MuDTSEU::reset() {
00158 
00159   m_startTS = 0;
00160   vector<L1MuDTEUX*>::iterator iter_eux;
00161   for ( iter_eux = m_EUXs.begin(); iter_eux != m_EUXs.end(); iter_eux++ ) {
00162     (*iter_eux)->reset();
00163   }
00164 
00165   m_ERS->reset();
00166   
00167   m_EXtable.reset();
00168   m_QStable.reset();
00169   
00170 }
00171 
00172 
00173 //
00174 // reset a single extrapolation
00175 //
00176 void L1MuDTSEU::reset(unsigned int relAdr) {
00177 
00178   m_EXtable.reset(relAdr);
00179   m_QStable.reset(relAdr);
00180   m_EUXs[relAdr]->reset();
00181 //  m_ERS->reset();
00182   
00183 }
00184 
00185 
00186 //
00187 // get number of successful extrapolations
00188 //
00189 int L1MuDTSEU::numberOfExt() const {
00190 
00191   int number = 0;
00192   vector<L1MuDTEUX*>::const_iterator iter_eux;
00193   for ( iter_eux = m_EUXs.begin(); iter_eux != m_EUXs.end(); iter_eux++ ) {
00194     if ( (*iter_eux)->result() ) number++;
00195   }
00196 
00197   return number;
00198 
00199 }