CMS 3D CMS Logo

L1MuDTSectorProcessor.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: L1MuDTSectorProcessor
00004 //
00005 //   Description: Sector Processor
00006 //
00007 //
00008 //   $Date: 2008/05/09 15:01:59 $
00009 //   $Revision: 1.5 $
00010 //
00011 //   Author :
00012 //   N. Neumeister            CERN EP
00013 //   J. Troconiz              UAM Madrid
00014 //
00015 //--------------------------------------------------
00016 
00017 //-----------------------
00018 // This Class's Header --
00019 //-----------------------
00020 
00021 #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h"
00022 
00023 //---------------
00024 // C++ Headers --
00025 //---------------
00026 
00027 #include <iostream>
00028 #include <cmath>
00029 
00030 //-------------------------------
00031 // Collaborating Class Headers --
00032 //-------------------------------
00033 
00034 #include <FWCore/Framework/interface/Event.h>
00035 #include "L1Trigger/DTTrackFinder/src/L1MuDTTFConfig.h"
00036 #include "L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h"
00037 #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.h"
00038 #include "L1Trigger/DTTrackFinder/src/L1MuDTDataBuffer.h"
00039 #include "L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h"
00040 #include "L1Trigger/DTTrackFinder/src/L1MuDTTrackAssembler.h"
00041 #include "L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h"
00042 #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackFinder.h"
00043 #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrack.h"
00044 
00045 using namespace std;
00046 
00047 // --------------------------------
00048 //       class L1MuDTSectorProcessor
00049 //---------------------------------
00050 
00051 //----------------
00052 // Constructors --
00053 //----------------
00054 
00055 L1MuDTSectorProcessor::L1MuDTSectorProcessor(const L1MuDTTrackFinder& tf,
00056                                              const L1MuDTSecProcId& id) :
00057       m_tf(tf), m_spid(id), 
00058       m_SectorReceiver(new L1MuDTSectorReceiver(*this)),
00059       m_DataBuffer(new L1MuDTDataBuffer(*this)),
00060       m_EU(new L1MuDTExtrapolationUnit(*this)),
00061       m_TA(new L1MuDTTrackAssembler(*this)), 
00062       m_AUs(), m_TrackCands(), m_TracKCands() {
00063 
00064   // 2 assignment units
00065   m_AUs.reserve(2);
00066   m_AUs.push_back(new L1MuDTAssignmentUnit(*this,0));
00067   m_AUs.push_back(new L1MuDTAssignmentUnit(*this,1));
00068 
00069   // now the 2 track candidates
00070   m_TrackCands.reserve(2);
00071   m_TrackCands.push_back(new L1MuDTTrack(m_spid) );
00072   m_TrackCands.push_back(new L1MuDTTrack(m_spid) );
00073 
00074   m_TracKCands.reserve(2);
00075   m_TracKCands.push_back(new L1MuDTTrack(m_spid) );
00076   m_TracKCands.push_back(new L1MuDTTrack(m_spid) );
00077   
00078 }
00079 
00080 
00081 //--------------
00082 // Destructor --
00083 //--------------
00084 
00085 L1MuDTSectorProcessor::~L1MuDTSectorProcessor() {
00086 
00087   delete m_SectorReceiver;
00088   delete m_DataBuffer;
00089   delete m_EU;
00090   delete m_TA;
00091   delete m_AUs[0];
00092   delete m_AUs[1];
00093   delete m_TrackCands[0];
00094   delete m_TrackCands[1];
00095   delete m_TracKCands[0];
00096   delete m_TracKCands[1];
00097 
00098 }
00099 
00100 //--------------
00101 // Operations --
00102 //--------------
00103 
00104 //
00105 // run Sector Processor
00106 //
00107 void L1MuDTSectorProcessor::run(int bx, const edm::Event& e, const edm::EventSetup& c) {
00108 
00109   // receive data and store them into the data buffer
00110   if ( m_SectorReceiver ) m_SectorReceiver->run(bx, e);
00111 
00112   // check content of data buffer
00113   if ( m_DataBuffer ) {
00114     if ( L1MuDTTFConfig::Debug(4) && m_DataBuffer->numberTSphi() > 0 ) {
00115       cout << "Phi track segments received by " << m_spid << " : " << endl;
00116       m_DataBuffer->printTSphi();
00117     }
00118   }
00119 
00120   // perform all extrapolations
00121   int n_ext = 0;        // number of successful extrapolations
00122   if ( m_EU && m_DataBuffer && m_DataBuffer->numberTSphi() > 1 ) {
00123     m_EU->run(c);
00124     n_ext = m_EU->numberOfExt();
00125     if ( L1MuDTTFConfig::Debug(3) && n_ext > 0  ) {
00126       cout << "Number of successful extrapolations : " << n_ext << endl;
00127       m_EU->print();
00128     }
00129   }
00130 
00131   // hardware debug (output from Extrapolator and Quality Sorter)
00132   // m_EU->print(1);
00133 
00134   // perform track assembling
00135   if ( m_TA &&  n_ext > 0 ) {
00136     m_TA->run();
00137     if ( L1MuDTTFConfig::Debug(3) ) m_TA->print();
00138   }
00139 
00140   // assign pt, eta, phi and quality
00141   if ( m_AUs[0] && !m_TA->isEmpty(0) ) m_AUs[0]->run(c);
00142   if ( m_AUs[1] && !m_TA->isEmpty(1) ) m_AUs[1]->run(c);
00143 
00144 } 
00145 
00146 
00147 //
00148 // reset Sector Processor
00149 //
00150 void L1MuDTSectorProcessor::reset() {
00151 
00152   if ( m_SectorReceiver ) m_SectorReceiver->reset();
00153   if ( m_DataBuffer ) m_DataBuffer->reset();
00154   if ( m_EU ) m_EU->reset();
00155   if ( m_TA ) m_TA->reset();
00156   if ( m_AUs[0] ) m_AUs[0]->reset();
00157   if ( m_AUs[1] ) m_AUs[1]->reset();
00158   if ( m_TrackCands[0] ) m_TrackCands[0]->reset();
00159   if ( m_TrackCands[1] ) m_TrackCands[1]->reset();
00160   if ( m_TracKCands[0] ) m_TracKCands[0]->reset();
00161   if ( m_TracKCands[1] ) m_TracKCands[1]->reset();
00162 
00163 } 
00164 
00165 
00166 //
00167 // print candidates found in Sector Processor
00168 //
00169 void L1MuDTSectorProcessor::print() const {
00170 
00171   if ( anyTrack() ) {
00172     cout << "Muon candidates found in " << m_spid << " : " << endl;
00173     vector<L1MuDTTrack*>::const_iterator iter = m_TrackCands.begin();
00174     while ( iter != m_TrackCands.end() ) {
00175       if ( *iter) (*iter)->print();
00176       iter++;
00177     }
00178   }
00179 
00180 }
00181 
00182 
00183 //
00184 // return pointer to nextWheel neighbour
00185 //
00186 const L1MuDTSectorProcessor* L1MuDTSectorProcessor::neighbour() const {
00187 
00188   int sector = m_spid.sector();
00189   int wheel  = m_spid.wheel();
00190 
00191   // the neighbour is in the same wedge with the following definition:
00192   // current SP  -3  -2  -1  +1  +2  +3
00193   // neighbour   -2  -1  +1   0  +1  +2
00194 
00195   if ( wheel == 1) return 0;
00196   wheel = (wheel == -1) ? 1 : (wheel/abs(wheel)) * (abs(wheel)-1);
00197 
00198   const L1MuDTSecProcId id(wheel,sector);
00199 
00200   return m_tf.sp(id);
00201 
00202 }
00203 
00204 
00205 //
00206 // are there any muon candidates?
00207 //
00208 bool L1MuDTSectorProcessor::anyTrack() const {
00209 
00210   if ( m_TrackCands[0] && !m_TrackCands[0]->empty() ) return true;
00211   if ( m_TrackCands[1] && !m_TrackCands[1]->empty() ) return true;
00212   
00213   return false;
00214 
00215 }

Generated on Tue Jun 9 17:40:01 2009 for CMSSW by  doxygen 1.5.4