CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: L1MuDTDataBuffer
00004 //
00005 //   Description: Data Buffer 
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/L1MuDTDataBuffer.h"
00021 
00022 //---------------
00023 // C++ Headers --
00024 //---------------
00025 
00026 #include <iostream>
00027 #include <vector>
00028 #include <cmath>
00029 
00030 //-------------------------------
00031 // Collaborating Class Headers --
00032 //-------------------------------
00033 
00034 #include "L1Trigger/DTTrackFinder/src/L1MuDTTFConfig.h"
00035 #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h"
00036 #include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.h"
00037 #include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h"
00038 
00039 using namespace std;
00040 
00041 // --------------------------------
00042 //       class L1MuDTDataBuffer
00043 //---------------------------------
00044 
00045 //----------------
00046 // Constructors --
00047 //----------------
00048 L1MuDTDataBuffer::L1MuDTDataBuffer(const L1MuDTSectorProcessor& sp) : 
00049         m_sp(sp), m_tsphi(0) {
00050 
00051 
00052   m_tsphi = new TSPhivector(38);
00053   m_tsphi->reserve(38);
00054 
00055 }
00056 
00057 
00058 //--------------
00059 // Destructor --
00060 //--------------
00061 L1MuDTDataBuffer::~L1MuDTDataBuffer() { 
00062 
00063   delete m_tsphi;
00064   
00065 }
00066 
00067 
00068 //--------------
00069 // Operations --
00070 //--------------
00071 
00072 //
00073 // clear buffer
00074 //
00075 void L1MuDTDataBuffer::reset() {
00076 
00077   TSPhivector::iterator iter = m_tsphi->begin();
00078   while ( iter != m_tsphi->end() ) {
00079     if ( *iter) {
00080       delete *iter; 
00081       *iter = 0;
00082     }
00083     iter++;
00084   }
00085 
00086 }
00087 
00088 
00089 //
00090 // get phi track segment of a given station 
00091 //
00092 const L1MuDTTrackSegPhi* L1MuDTDataBuffer::getTSphi(int station, int reladr) const {
00093 
00094   int address = (station == 1) ? reladr : reladr + (station-2)*12 + 2;
00095   return (*m_tsphi)[address];
00096   
00097 }
00098 
00099 
00100 //
00101 // add new phi track segment to the buffer
00102 //
00103 void L1MuDTDataBuffer::addTSphi(int adr, const L1MuDTTrackSegPhi& ts) {
00104 
00105   L1MuDTTrackSegPhi* tmpts = new L1MuDTTrackSegPhi(ts);
00106   (*m_tsphi)[adr] = tmpts;
00107   
00108 }
00109 
00110 
00111 //
00112 // print all phi track segments in the buffer 
00113 //
00114 void L1MuDTDataBuffer::printTSphi() const {
00115 
00116   TSPhivector::const_iterator iter = m_tsphi->begin();
00117   while ( iter != m_tsphi->end() ) {
00118     if ( *iter ) cout << *(*iter) << endl;
00119     iter++;
00120   }
00121   
00122 }
00123 
00124 
00125 //
00126 // count number of non empty phi track segments
00127 //
00128 int L1MuDTDataBuffer::numberTSphi() const {
00129 
00130   int count = 0;
00131   TSPhivector::iterator iter = m_tsphi->begin();
00132   while ( iter != m_tsphi->end() ) {
00133     if ( *iter && !(*iter)->empty() ) count++;
00134     iter++;
00135   }
00136   return count;
00137 
00138 }