CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/L1Trigger/DTSectorCollector/src/DTSectCollPhCand.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: DTSectCollPhCand.cpp
00004 //
00005 //   Description: A Sector Collector Phi Candidate
00006 //
00007 //
00008 //   Author List:
00009 //   S.Marcellini D.Bonacorsi
00010 //   Modifications: 
00011 //   11/06 C. Battilana: Class moved from Cand to PhCand
00012 //
00013 //
00014 //--------------------------------------------------
00015 
00016 
00017 //-----------------------
00018 // This Class's Header --
00019 //-----------------------
00020 #include "L1Trigger/DTSectorCollector/interface/DTSectCollPhCand.h"
00021 
00022 //---------------
00023 // C++ Headers --
00024 //---------------
00025 #include <iostream>
00026 
00027 //----------------
00028 // Constructors --
00029 //---------------- // SM double TSM 
00030 DTSectCollPhCand::DTSectCollPhCand(DTSC* tsc, const DTChambPhSegm* tsmsegm, int ifs) 
00031   : _tsc(tsc), _tsmsegm(tsmsegm) {
00032   _dataword.one();              // reset dataword to 0x1ff
00033   if(ifs==1)_dataword.unset(14); // set bit 14 (0=first, 1=second tracks)
00034 }
00035 
00036 
00037 DTSectCollPhCand::DTSectCollPhCand() {
00038  
00039 }
00040 
00041 //--------------
00042 // Destructor --
00043 //--------------
00044 DTSectCollPhCand::~DTSectCollPhCand(){
00045 }
00046 
00047 
00048 //--------------
00049 // Operations --
00050 //--------------
00051 
00052 DTSectCollPhCand& 
00053 DTSectCollPhCand::operator=(const DTSectCollPhCand& tsccand) {
00054   if(this != &tsccand){
00055     _tsc = tsccand._tsc;
00056     _tsmsegm = tsccand._tsmsegm;
00057   }
00058   return *this;
00059 }
00060 
00061 void
00062 DTSectCollPhCand::clear()  { 
00063   _tsmsegm=0; 
00064   _dataword.one();
00065 //   std::cout << " clear dataword : " << _dataword.print() << std::endl;
00066 }
00067 
00068 int
00069 DTSectCollPhCand::CoarseSync() const{
00070   int sect= _tsmsegm->ChamberId().sector();
00071   if (sect<13) 
00072     return config()->CoarseSync(_tsmsegm->ChamberId().station());
00073   else 
00074     return config()->CoarseSync(5);
00075 }
00076 
00077 // SM double TSM: remove datawordbk and replace it with dataword
00078 void
00079 DTSectCollPhCand::setBitsSectColl() {
00080 
00081   clearBitsSectColl();
00082     
00083   if(abs(_tsmsegm->DeltaPsiR())>1024 ){ // Check phiB within 10 bits range
00084     std::cout << "DTSectCollPhCand::setBitsSectColl phiB outside valid range: " << _tsmsegm->DeltaPsiR();
00085     std::cout << " deltaPsiR set to 512" <<  std::endl;
00086   }
00087   else {
00088     // SM double TSM
00089     // assign preview in dataword (common to any other assignment)
00090     _dataword.assign(0,10,abs(_tsmsegm->DeltaPsiR()));
00091     // 
00092     int a2  = 12;
00093     int a1  = 11;
00094     int a0  = 10;
00095    
00096     if( _tsmsegm->code()==6 ) { _dataword.unset(a2); _dataword.unset(a1); _dataword.unset(a0); }  // 1-000
00097     if( _tsmsegm->code()==5 ) { _dataword.unset(a2); _dataword.unset(a1); }                         // 1-001
00098     if( _tsmsegm->code()==4 ) { _dataword.unset(a2); _dataword.unset(a0); }                         // 1-010
00099     if( _tsmsegm->code()==3 ) { _dataword.unset(a1); }                                                // 1-101
00100     if( _tsmsegm->code()==2 ) { _dataword.unset(a1); _dataword.unset(a0); }                         // 1-100
00101     // if( _tsmsegm->code()==1 ) no unset needed => 111
00102     if( _tsmsegm->code()==0 ) { _dataword.unset(a0); }                                                // 1-110
00103 
00104   }
00105   
00106 }
00107 
00108 
00109   void 
00110   DTSectCollPhCand::print() const {
00111     std::cout << "Sector Collector Phi Candidate: " << std::endl; 
00112     if(_dataword.element(14)==0) {std::cout << "First track type" << std::endl;}
00113     else {std::cout << "Second track type" << std::endl;}
00114        std::cout << " code=" << _tsmsegm->pvCode();
00115         std::cout << " dataword=";
00116         _dataword.print();
00117     // SM double TSM remove datawordbk section
00118         std::cout << " SC step=" << CoarseSync()+_tsmsegm->step(); 
00119     std::cout << std::endl;
00120   }
00121