Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:58

0001 //-------------------------------------------------
0002 //
0003 //   Class: DTSectCollPhCand.cpp
0004 //
0005 //   Description: A Sector Collector Phi Candidate
0006 //
0007 //
0008 //   Author List:
0009 //   S.Marcellini D.Bonacorsi
0010 //   Modifications:
0011 //   11/06 C. Battilana: Class moved from Cand to PhCand
0012 //
0013 //
0014 //--------------------------------------------------
0015 
0016 //-----------------------
0017 // This Class's Header --
0018 //-----------------------
0019 #include "L1Trigger/DTSectorCollector/interface/DTSectCollPhCand.h"
0020 
0021 //---------------
0022 // C++ Headers --
0023 //---------------
0024 #include <iostream>
0025 
0026 //----------------
0027 // Constructors --
0028 //---------------- // SM double TSM
0029 DTSectCollPhCand::DTSectCollPhCand(DTSC* tsc, const DTChambPhSegm* tsmsegm, int ifs) : _tsc(tsc), _tsmsegm(tsmsegm) {
0030   _dataword.one();  // reset dataword to 0x1ff
0031   if (ifs == 1)
0032     _dataword.unset(14);  // set bit 14 (0=first, 1=second tracks)
0033 }
0034 
0035 DTSectCollPhCand::DTSectCollPhCand() {}
0036 
0037 //--------------
0038 // Destructor --
0039 //--------------
0040 DTSectCollPhCand::~DTSectCollPhCand() {}
0041 
0042 //--------------
0043 // Operations --
0044 //--------------
0045 
0046 DTSectCollPhCand& DTSectCollPhCand::operator=(const DTSectCollPhCand& tsccand) {
0047   if (this != &tsccand) {
0048     _tsc = tsccand._tsc;
0049     _tsmsegm = tsccand._tsmsegm;
0050   }
0051   return *this;
0052 }
0053 
0054 void DTSectCollPhCand::clear() {
0055   _tsmsegm = nullptr;
0056   _dataword.one();
0057   //   std::cout << " clear dataword : " << _dataword.print() << std::endl;
0058 }
0059 
0060 int DTSectCollPhCand::CoarseSync() const {
0061   int sect = _tsmsegm->ChamberId().sector();
0062   if (sect < 13)
0063     return config()->CoarseSync(_tsmsegm->ChamberId().station());
0064   else
0065     return config()->CoarseSync(5);
0066 }
0067 
0068 // SM double TSM: remove datawordbk and replace it with dataword
0069 void DTSectCollPhCand::setBitsSectColl() {
0070   clearBitsSectColl();
0071 
0072   if (abs(_tsmsegm->DeltaPsiR()) > 1024) {  // Check phiB within 10 bits range
0073     std::cout << "DTSectCollPhCand::setBitsSectColl phiB outside valid range: " << _tsmsegm->DeltaPsiR();
0074     std::cout << " deltaPsiR set to 512" << std::endl;
0075   } else {
0076     // SM double TSM
0077     // assign preview in dataword (common to any other assignment)
0078     _dataword.assign(0, 10, abs(_tsmsegm->DeltaPsiR()));
0079     //
0080     int a2 = 12;
0081     int a1 = 11;
0082     int a0 = 10;
0083 
0084     if (_tsmsegm->code() == 6) {
0085       _dataword.unset(a2);
0086       _dataword.unset(a1);
0087       _dataword.unset(a0);
0088     }  // 1-000
0089     if (_tsmsegm->code() == 5) {
0090       _dataword.unset(a2);
0091       _dataword.unset(a1);
0092     }  // 1-001
0093     if (_tsmsegm->code() == 4) {
0094       _dataword.unset(a2);
0095       _dataword.unset(a0);
0096     }  // 1-010
0097     if (_tsmsegm->code() == 3) {
0098       _dataword.unset(a1);
0099     }  // 1-101
0100     if (_tsmsegm->code() == 2) {
0101       _dataword.unset(a1);
0102       _dataword.unset(a0);
0103     }  // 1-100
0104     // if( _tsmsegm->code()==1 ) no unset needed => 111
0105     if (_tsmsegm->code() == 0) {
0106       _dataword.unset(a0);
0107     }  // 1-110
0108   }
0109 }
0110 
0111 void DTSectCollPhCand::print() const {
0112   std::cout << "Sector Collector Phi Candidate: " << std::endl;
0113   if (_dataword.element(14) == 0) {
0114     std::cout << "First track type" << std::endl;
0115   } else {
0116     std::cout << "Second track type" << std::endl;
0117   }
0118   std::cout << " code=" << _tsmsegm->pvCode();
0119   std::cout << " dataword=";
0120   _dataword.print();
0121   // SM double TSM remove datawordbk section
0122   std::cout << " SC step=" << CoarseSync() + _tsmsegm->step();
0123   std::cout << std::endl;
0124 }