CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/L1Trigger/DTTrackFinder/src/L1MuDTERS.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: L1MuDTERS
00004 //
00005 //   Description: Extrapolation Result Selector
00006 //
00007 //
00008 //   $Date: 2007/02/27 11:44:00 $
00009 //   $Revision: 1.2 $
00010 //
00011 //   Author :
00012 //   N. Neumeister            CERN EP
00013 //
00014 //--------------------------------------------------
00015 
00016 //-----------------------
00017 // This Class's Header --
00018 //-----------------------
00019 
00020 #include "L1Trigger/DTTrackFinder/src/L1MuDTERS.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/L1MuDTTrackSegPhi.h"
00035 #include "L1Trigger/DTTrackFinder/src/L1MuDTSEU.h"
00036 #include "L1Trigger/DTTrackFinder/src/L1MuDTEUX.h"
00037 
00038 using namespace std;
00039 
00040 // --------------------------------
00041 //       class L1MuDTERS
00042 //---------------------------------
00043 
00044 //----------------
00045 // Constructors --
00046 //----------------
00047 
00048 L1MuDTERS::L1MuDTERS(const L1MuDTSEU& seu) : m_seu(seu) {
00049 
00050   reset();
00051 
00052 }
00053   
00054 
00055 //--------------
00056 // Destructor --
00057 //--------------
00058 
00059 L1MuDTERS::~L1MuDTERS() {}
00060 
00061 
00062 //--------------
00063 // Operations --
00064 //--------------
00065 
00066 //
00067 // run ERS
00068 //
00069 void L1MuDTERS::run() {
00070 
00071   int n_ext = m_seu.numberOfExt();
00072   if ( n_ext > 0 ) {
00073     vector<L1MuDTEUX*>::const_iterator first = m_seu.eux().begin();
00074     vector<L1MuDTEUX*>::const_iterator last  = m_seu.eux().end();
00075     vector<L1MuDTEUX*>::const_iterator first_max;
00076     vector<L1MuDTEUX*>::const_iterator second_max;
00077 
00078     // find the best extrapolation
00079     first_max  = max_element(first, last, L1MuDTEUX::EUX_Comp() );
00080     m_address[0] = (*first_max)->address();
00081     m_quality[0] = (*first_max)->quality();
00082     m_start[0]   = (*first_max)->ts().first;
00083     m_target[0]  = (*first_max)->ts().second;
00084 
00085 
00086     if ( n_ext > 1 ) {
00087       // find the second best extrapolation 
00088       second_max = max_element(first, last, L1MuDTEUX::EUX_Comp(*first_max) );
00089       m_address[1] =  (*second_max)->address();
00090       m_quality[1] =  (*second_max)->quality();
00091       m_start[1]   =  (*second_max)->ts().first;
00092       m_target[1]  =  (*second_max)->ts().second;
00093     }
00094 
00095     if ( L1MuDTTFConfig::Debug(4) ) {
00096       cout << "ERS : " << endl;
00097       cout << "\t first  : " << m_address[0] << '\t' << m_quality[0] << endl;
00098       cout << "\t second : " << m_address[1] << '\t' << m_quality[1] << endl;
00099     }
00100 
00101   }
00102 
00103 }
00104 
00105 
00106 //
00107 // reset ERS
00108 //
00109 void L1MuDTERS::reset() {
00110 
00111   for ( int id  = 0; id < 2; id++ ) {
00112     m_quality[id] = 0; 
00113     m_address[id] = 15;                                            
00114     m_start[id]   = 0;
00115     m_target[id]  = 0;  
00116   }
00117 
00118 }
00119 
00120 
00121 //
00122 // return pointer to start and target track segment
00123 //
00124 pair<const L1MuDTTrackSegPhi*, const L1MuDTTrackSegPhi*> L1MuDTERS::ts(int id) const {
00125 
00126   return pair<const L1MuDTTrackSegPhi*,const L1MuDTTrackSegPhi*>(m_start[id],m_target[id]);
00127 
00128 }